tftp/tftp.spec

Mon, 25 Aug 2014 19:07:19 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 25 Aug 2014 19:07:19 +0200
changeset 796
02101011a9bc
parent 795
ef076e9bc56b
permissions
-rw-r--r--

Correct process identification writing of PID file on -P parameter.

michael@795 1 ##
michael@795 2 ## tftp.spec -- OpenPKG RPM Package Specification
michael@795 3 ## Copyright (c) 2000-2014 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@795 4 ##
michael@795 5 ## Permission to use, copy, modify, and distribute this software for
michael@795 6 ## any purpose with or without fee is hereby granted, provided that
michael@795 7 ## the above copyright notice and this permission notice appear in all
michael@795 8 ## copies.
michael@795 9 ##
michael@795 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@795 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@795 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@795 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@795 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@795 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@795 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@795 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@795 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@795 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@795 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@795 21 ## SUCH DAMAGE.
michael@795 22 ##
michael@795 23
michael@795 24 # package information
michael@795 25 Name: tftp
michael@795 26 Summary: TFTP Client and Server
michael@795 27 URL: http://www.kernel.org/pub/software/network/tftp/
michael@795 28 Vendor: H. Peter Anvin
michael@795 29 Packager: OpenPKG Foundation e.V.
michael@795 30 Distribution: OpenPKG Community
michael@795 31 Class: BASE
michael@795 32 Group: FTP
michael@795 33 License: GPL
michael@795 34 Version: 5.2
michael@796 35 Release: 20140800
michael@795 36
michael@795 37 # package options
michael@795 38 %option with_fsl yes
michael@795 39
michael@795 40 # list of sources
michael@795 41 Source0: http://www.kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-%{version}.tar.gz
michael@795 42 Source1: tftpd.remap
michael@795 43 Source2: rc.tftp
michael@795 44 Source3: fsl.tftp
michael@795 45 Patch0: tftp.patch
michael@795 46
michael@795 47 # build information
michael@795 48 BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc
michael@795 49 PreReq: OpenPKG, openpkg >= 20100101
michael@795 50 BuildPreReq: getopt
michael@795 51 PreReq: getopt
michael@795 52 %if "%{with_fsl}" == "yes"
michael@795 53 BuildPreReq: fsl
michael@795 54 PreReq: fsl
michael@795 55 %endif
michael@795 56
michael@795 57 %description
michael@795 58 This is a portable client and server for the Trivial File Transfer
michael@795 59 Protocol (TFTP).
michael@795 60
michael@795 61 %track
michael@795 62 prog tftp = {
michael@795 63 version = %{version}
michael@795 64 url = http://www.kernel.org/pub/software/network/tftp/tftp-hpa/
michael@795 65 regex = tftp-hpa-(__VER__)\.tar\.gz
michael@795 66 }
michael@795 67
michael@795 68 %prep
michael@795 69 %setup -q -n tftp-hpa-%{version}
michael@795 70 %patch -p0
michael@795 71 %{l_shtool} subst -e 's;PKTSIZE;TFTP_PKTSIZE;g' */*.[ch]
michael@795 72
michael@795 73 %build
michael@795 74 export CC="%{l_cc}"
michael@795 75 export CFLAGS="%{l_cflags -O} %{l_cppflags} -DPID_FILE='\"%{l_prefix}/var/tftp/tftpd.pid\"'"
michael@795 76 export CPPFLAGS="%{l_cppflags}"
michael@795 77 export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}"
michael@795 78 export LIBS="%{l_fsl_libs} -lgetopt"
michael@795 79 case "%{l_platform -t}" in
michael@795 80 *-netbsd* )
michael@795 81 CFLAGS="$CFLAGS -D_NETBSD_SOURCE"
michael@795 82 CPPFLAGS="$CPPFLAGS -D_NETBSD_SOURCE"
michael@795 83 ;;
michael@795 84 esac
michael@795 85 ./configure \
michael@795 86 --prefix=%{l_prefix} \
michael@795 87 --mandir=%{l_prefix}/man \
michael@795 88 --with-remap \
michael@795 89 --without-tcpwrappers \
michael@795 90 --without-readline
michael@795 91 %{l_shtool} subst -e 's; -W[^ ]*;;g' MCONFIG
michael@795 92 %{l_make} %{l_mflags}
michael@795 93
michael@795 94 %install
michael@795 95 %{l_shtool} mkdir -f -p -m 755 \
michael@795 96 $RPM_BUILD_ROOT%{l_prefix}/var/tftp \
michael@795 97 $RPM_BUILD_ROOT%{l_prefix}/etc/tftp \
michael@795 98 $RPM_BUILD_ROOT%{l_prefix}/var/tftp
michael@795 99 %{l_make} %{l_mflags} install \
michael@795 100 INSTALL="%{l_shtool} install -c" \
michael@795 101 INSTALLROOT=$RPM_BUILD_ROOT
michael@795 102 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@795 103 %{SOURCE tftpd.remap} $RPM_BUILD_ROOT%{l_prefix}/etc/tftp/
michael@795 104 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/tftpd.8
michael@795 105 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/in.tftpd.8 \
michael@795 106 $RPM_BUILD_ROOT%{l_prefix}/man/man8/tftpd.8
michael@795 107 mv $RPM_BUILD_ROOT%{l_prefix}/sbin/in.tftpd \
michael@795 108 $RPM_BUILD_ROOT%{l_prefix}/sbin/tftpd
michael@795 109 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@795 110 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
michael@795 111
michael@795 112 # install run-command script
michael@795 113 %{l_shtool} mkdir -f -p -m 755 \
michael@795 114 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@795 115 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@795 116 %{SOURCE rc.tftp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@795 117
michael@795 118 # install OSSP fsl configuration
michael@795 119 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
michael@795 120 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@795 121 %{SOURCE fsl.tftp} \
michael@795 122 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@795 123
michael@795 124 # determine installation files
michael@795 125 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@795 126 %{l_files_std} \
michael@795 127 '%config %{l_prefix}/etc/fsl/fsl.tftp' \
michael@795 128 '%config %{l_prefix}/etc/tftp/*'
michael@795 129
michael@795 130 %files -f files
michael@795 131
michael@795 132 %clean
michael@795 133
michael@795 134 %pre
michael@795 135 # before upgrade, save status and stop service
michael@795 136 [ $1 -eq 2 ] || exit 0
michael@795 137 eval `%{l_rc} tftp status 2>/dev/null | tee %{l_tmpfile}`
michael@795 138 %{l_rc} tftp stop 2>/dev/null
michael@795 139 exit 0
michael@795 140
michael@795 141 %post
michael@795 142 if [ $1 -eq 2 ]; then
michael@795 143 # after upgrade, restore status
michael@795 144 eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
michael@795 145 [ ".$tftp_active" = .yes ] && %{l_rc} tftp start
michael@795 146 fi
michael@795 147 exit 0
michael@795 148
michael@795 149 %preun
michael@795 150 # before erase, stop service and remove log files
michael@795 151 [ $1 -eq 0 ] || exit 0
michael@795 152 %{l_rc} tftp stop 2>/dev/null
michael@795 153 rm -f $RPM_INSTALL_PREFIX/var/tftp/*.log* >/dev/null 2>&1 || true
michael@795 154 exit 0
michael@795 155

mercurial