tftp.spec 5.0 KB

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