tftp.spec 5.2 KB

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