1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tftp/tftp.spec Mon Aug 25 19:06:31 2014 +0200 1.3 @@ -0,0 +1,155 @@ 1.4 +## 1.5 +## tftp.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2014 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package information 1.28 +Name: tftp 1.29 +Summary: TFTP Client and Server 1.30 +URL: http://www.kernel.org/pub/software/network/tftp/ 1.31 +Vendor: H. Peter Anvin 1.32 +Packager: OpenPKG Foundation e.V. 1.33 +Distribution: OpenPKG Community 1.34 +Class: BASE 1.35 +Group: FTP 1.36 +License: GPL 1.37 +Version: 5.2 1.38 +Release: 20140301 1.39 + 1.40 +# package options 1.41 +%option with_fsl yes 1.42 + 1.43 +# list of sources 1.44 +Source0: http://www.kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-%{version}.tar.gz 1.45 +Source1: tftpd.remap 1.46 +Source2: rc.tftp 1.47 +Source3: fsl.tftp 1.48 +Patch0: tftp.patch 1.49 + 1.50 +# build information 1.51 +BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc 1.52 +PreReq: OpenPKG, openpkg >= 20100101 1.53 +BuildPreReq: getopt 1.54 +PreReq: getopt 1.55 +%if "%{with_fsl}" == "yes" 1.56 +BuildPreReq: fsl 1.57 +PreReq: fsl 1.58 +%endif 1.59 + 1.60 +%description 1.61 + This is a portable client and server for the Trivial File Transfer 1.62 + Protocol (TFTP). 1.63 + 1.64 +%track 1.65 + prog tftp = { 1.66 + version = %{version} 1.67 + url = http://www.kernel.org/pub/software/network/tftp/tftp-hpa/ 1.68 + regex = tftp-hpa-(__VER__)\.tar\.gz 1.69 + } 1.70 + 1.71 +%prep 1.72 + %setup -q -n tftp-hpa-%{version} 1.73 + %patch -p0 1.74 + %{l_shtool} subst -e 's;PKTSIZE;TFTP_PKTSIZE;g' */*.[ch] 1.75 + 1.76 +%build 1.77 + export CC="%{l_cc}" 1.78 + export CFLAGS="%{l_cflags -O} %{l_cppflags} -DPID_FILE='\"%{l_prefix}/var/tftp/tftpd.pid\"'" 1.79 + export CPPFLAGS="%{l_cppflags}" 1.80 + export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" 1.81 + export LIBS="%{l_fsl_libs} -lgetopt" 1.82 + case "%{l_platform -t}" in 1.83 + *-netbsd* ) 1.84 + CFLAGS="$CFLAGS -D_NETBSD_SOURCE" 1.85 + CPPFLAGS="$CPPFLAGS -D_NETBSD_SOURCE" 1.86 + ;; 1.87 + esac 1.88 + ./configure \ 1.89 + --prefix=%{l_prefix} \ 1.90 + --mandir=%{l_prefix}/man \ 1.91 + --with-remap \ 1.92 + --without-tcpwrappers \ 1.93 + --without-readline 1.94 + %{l_shtool} subst -e 's; -W[^ ]*;;g' MCONFIG 1.95 + %{l_make} %{l_mflags} 1.96 + 1.97 +%install 1.98 + %{l_shtool} mkdir -f -p -m 755 \ 1.99 + $RPM_BUILD_ROOT%{l_prefix}/var/tftp \ 1.100 + $RPM_BUILD_ROOT%{l_prefix}/etc/tftp \ 1.101 + $RPM_BUILD_ROOT%{l_prefix}/var/tftp 1.102 + %{l_make} %{l_mflags} install \ 1.103 + INSTALL="%{l_shtool} install -c" \ 1.104 + INSTALLROOT=$RPM_BUILD_ROOT 1.105 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.106 + %{SOURCE tftpd.remap} $RPM_BUILD_ROOT%{l_prefix}/etc/tftp/ 1.107 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/tftpd.8 1.108 + mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/in.tftpd.8 \ 1.109 + $RPM_BUILD_ROOT%{l_prefix}/man/man8/tftpd.8 1.110 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/in.tftpd \ 1.111 + $RPM_BUILD_ROOT%{l_prefix}/sbin/tftpd 1.112 + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true 1.113 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 1.114 + 1.115 + # install run-command script 1.116 + %{l_shtool} mkdir -f -p -m 755 \ 1.117 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.118 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.119 + %{SOURCE rc.tftp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.120 + 1.121 + # install OSSP fsl configuration 1.122 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.123 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.124 + %{SOURCE fsl.tftp} \ 1.125 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.126 + 1.127 + # determine installation files 1.128 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.129 + %{l_files_std} \ 1.130 + '%config %{l_prefix}/etc/fsl/fsl.tftp' \ 1.131 + '%config %{l_prefix}/etc/tftp/*' 1.132 + 1.133 +%files -f files 1.134 + 1.135 +%clean 1.136 + 1.137 +%pre 1.138 + # before upgrade, save status and stop service 1.139 + [ $1 -eq 2 ] || exit 0 1.140 + eval `%{l_rc} tftp status 2>/dev/null | tee %{l_tmpfile}` 1.141 + %{l_rc} tftp stop 2>/dev/null 1.142 + exit 0 1.143 + 1.144 +%post 1.145 + if [ $1 -eq 2 ]; then 1.146 + # after upgrade, restore status 1.147 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} 1.148 + [ ".$tftp_active" = .yes ] && %{l_rc} tftp start 1.149 + fi 1.150 + exit 0 1.151 + 1.152 +%preun 1.153 + # before erase, stop service and remove log files 1.154 + [ $1 -eq 0 ] || exit 0 1.155 + %{l_rc} tftp stop 2>/dev/null 1.156 + rm -f $RPM_INSTALL_PREFIX/var/tftp/*.log* >/dev/null 2>&1 || true 1.157 + exit 0 1.158 +