ntp.spec 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. ##
  2. ## ntp.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: ntp
  27. Summary: Network Time Protocol (NTP) Daemon
  28. URL: http://www.ntp.org/
  29. Vendor: David L. Mills
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: CORE
  33. Group: Network
  34. License: BSD-style
  35. Version: 4.2.0
  36. Release: 20040601
  37. # package options
  38. %option with_fsl yes
  39. %option with_crypto yes
  40. %option with_sntp yes
  41. # list of sources
  42. Source0: ftp://ftp.udel.edu/pub/ntp/ntp4/ntp-%{version}.tar.gz
  43. Source1: ntp-doc.tar.gz
  44. Source2: ntp.conf
  45. Source3: rc.ntp
  46. Source4: fsl.ntp
  47. Patch0: ntp.patch
  48. # build information
  49. Prefix: %{l_prefix}
  50. BuildRoot: %{l_buildroot}
  51. BuildPreReq: OpenPKG, openpkg >= 20040130, make
  52. PreReq: OpenPKG, openpkg >= 20040130
  53. %if "%{with_fsl}" == "yes"
  54. BuildPreReq: fsl >= 1.2.0
  55. PreReq: fsl >= 1.2.0
  56. %endif
  57. %if "%{with_crypto}" == "yes"
  58. BuildPreReq: openssl, gcc
  59. PreReq: openssl
  60. %endif
  61. AutoReq: no
  62. AutoReqProv: no
  63. %description
  64. The Network Time Protocol (NTP) is used to synchronize the time
  65. of a computer client or server to another server or reference
  66. time source, such as a radio or satellite receiver or modem. It
  67. provides accuracies typically within a millisecond on LANs and
  68. up to a few tens of milliseconds on WANs relative to Coordinated
  69. Universal Time (UTC) via a Global Positioning Service (GPS)
  70. receiver, for example. Typical NTP configurations utilize multiple
  71. redundant servers and diverse network paths in order to achieve high
  72. accuracy and reliability. Some configurations include cryptographic
  73. authentication to prevent accidental or malicious protocol attacks
  74. and some provide automatic server discovery using IP multicast.
  75. %track
  76. prog ntp = {
  77. version = %{version}
  78. url = ftp://ftp.udel.edu/pub/ntp/ntp4/
  79. regex = ntp-(\d+\.\d+\.[0-6]?[0-9][a-z]?(-rc\d+)?)\.tar\.gz
  80. }
  81. %prep
  82. %setup -q
  83. %setup -q -T -D -a 1
  84. %patch -p0
  85. %build
  86. # configure program
  87. CC="%{l_cc}" \
  88. CFLAGS="%{l_cflags -O}" \
  89. LDFLAGS="%{l_fsl_ldflags}" \
  90. LIBS="%{l_fsl_libs}" \
  91. ./configure \
  92. --prefix=%{l_prefix} \
  93. %if "%{with_sntp}" == "yes"
  94. --with-sntp \
  95. %endif
  96. %if "%{with_crypto}" == "yes"
  97. --with-crypto \
  98. --with-openssl-libdir=%{l_prefix}/lib \
  99. --with-openssl-incdir=%{l_prefix}/include \
  100. %else
  101. --without-crypto \
  102. --without-openssl-libdir \
  103. --without-openssl-incdir \
  104. %endif
  105. --enable-ntpdate-step
  106. %{l_shtool} subst \
  107. -e 's;\(CONFIG_FILE[^"]*"\)/etc/ntp.conf;\1%{l_prefix}/etc/ntp/ntp.conf;' \
  108. include/ntp_config.h ntpdate/ntptime_config.c
  109. # build program
  110. %{l_make} %{l_mflags -O}
  111. %install
  112. # install program
  113. rm -rf $RPM_BUILD_ROOT
  114. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  115. # install manual pages
  116. ( cd ntp-doc
  117. %{l_shtool} mkdir -f -p -m 755 \
  118. $RPM_BUILD_ROOT%{l_prefix}/man/man5
  119. %{l_shtool} install -c -m 644 \
  120. *.5 $RPM_BUILD_ROOT%{l_prefix}/man/man5/
  121. %{l_shtool} mkdir -f -p -m 755 \
  122. $RPM_BUILD_ROOT%{l_prefix}/man/man8
  123. %{l_shtool} install -c -m 644 *.8 \
  124. $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  125. ) || exit $?
  126. # install default configuration
  127. %{l_shtool} mkdir -f -p -m 755 \
  128. $RPM_BUILD_ROOT%{l_prefix}/etc/ntp
  129. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  130. %{SOURCE ntp.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/ntp/
  131. # post-adjust installation
  132. %{l_shtool} mkdir -f -p -m 755 \
  133. $RPM_BUILD_ROOT%{l_prefix}/var/ntp/ntpd.stat
  134. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  135. # install run-command script
  136. %{l_shtool} mkdir -f -p -m 755 \
  137. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  138. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  139. %{SOURCE rc.ntp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  140. # install OSSP fsl configuration
  141. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  142. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  143. %{SOURCE fsl.ntp} \
  144. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  145. # determine installation files
  146. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  147. %{l_files_std} \
  148. '%not %dir %{l_prefix}/etc/fsl' \
  149. '%config %{l_prefix}/etc/fsl/fsl.ntp' \
  150. '%config %{l_prefix}/etc/ntp/ntp.conf'
  151. %files -f files
  152. %clean
  153. rm -rf $RPM_BUILD_ROOT
  154. %post
  155. # after upgrade, restart service
  156. [ $1 -eq 2 ] || exit 0
  157. eval `%{l_rc} ntp status 2>/dev/null`
  158. [ ".$ntp_active" = .yes ] && %{l_rc} ntp restart
  159. exit 0
  160. %preun
  161. # before erase, stop service and remove log files
  162. [ $1 -eq 0 ] || exit 0
  163. %{l_rc} ntp stop 2>/dev/null
  164. rm -f $RPM_INSTALL_PREFIX/var/ntp/ntp.log* >/dev/null 2>&1 || true
  165. exit 0