ntp.spec 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. ##
  2. ## ntpd.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 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 [CORE]
  32. Group: Network
  33. License: BSD-style
  34. Version: 4.1.2
  35. Release: 20030811
  36. # package options
  37. %option with_fsl yes
  38. # list of sources
  39. Source0: ftp://ftp.udel.edu/pub/ntp/ntp4/ntp-%{version}.tar.gz
  40. Source1: ntp-doc.tar.gz
  41. Source2: ntp.conf
  42. Source3: rc.ntp
  43. Source4: fsl.ntp
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20030718
  48. PreReq: OpenPKG, openpkg >= 20030718
  49. %if "%{with_fsl}" == "yes"
  50. BuildPreReq: fsl >= 1.2.0
  51. PreReq: fsl >= 1.2.0
  52. %endif
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. The Network Time Protocol (NTP) is used to synchronize the time
  57. of a computer client or server to another server or reference
  58. time source, such as a radio or satellite receiver or modem. It
  59. provides accuracies typically within a millisecond on LANs and
  60. up to a few tens of milliseconds on WANs relative to Coordinated
  61. Universal Time (UTC) via a Global Positioning Service (GPS)
  62. receiver, for example. Typical NTP configurations utilize multiple
  63. redundant servers and diverse network paths in order to achieve high
  64. accuracy and reliability. Some configurations include cryptographic
  65. authentication to prevent accidental or malicious protocol attacks
  66. and some provide automatic server discovery using IP multicast.
  67. %prep
  68. %setup0 -q -c
  69. %setup1 -q -T -D -a 1
  70. %build
  71. ( cd ntp-%{version}
  72. CC="%{l_cc}" \
  73. CFLAGS="%{l_cflags -O}" \
  74. LDFLAGS="%{l_fsl_ldflags}" \
  75. LIBS="%{l_fsl_libs}" \
  76. ./configure \
  77. --prefix=%{l_prefix}
  78. %{l_shtool} subst \
  79. -e 's;\(CONFIG_FILE[^"]*"\)/etc/ntp.conf;\1%{l_prefix}/etc/ntp/ntp.conf;' \
  80. include/ntp_config.h ntpdate/ntptime_config.c
  81. %{l_make} %{l_mflags -O}
  82. ) || exit $?
  83. %install
  84. rm -rf $RPM_BUILD_ROOT
  85. ( cd ntp-%{version}
  86. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  87. ) || exit $?
  88. ( cd ntp-doc
  89. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/man/man5
  90. %{l_shtool} install -c -m 644 *.5 $RPM_BUILD_ROOT%{l_prefix}/man/man5/
  91. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/man/man8
  92. %{l_shtool} install -c -m 644 *.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  93. ) || exit $?
  94. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/ntp
  95. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  96. %{SOURCE ntp.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/ntp/
  97. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/ntp/ntpd.stat
  98. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/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.ntp} $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.ntp} \
  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.ntp' \
  114. '%config %{l_prefix}/etc/ntp/ntp.conf'
  115. %files -f files
  116. %clean
  117. rm -rf $RPM_BUILD_ROOT
  118. %post
  119. # after upgrade, restart service
  120. [ $1 -eq 2 ] || exit 0
  121. eval `%{l_rc} ntp status 2>/dev/null`
  122. [ ".$ntp_active" = .yes ] && %{l_rc} ntp restart
  123. exit 0
  124. %preun
  125. # before erase, stop service and remove log files
  126. [ $1 -eq 0 ] || exit 0
  127. %{l_rc} ntp stop 2>/dev/null
  128. rm -f $RPM_INSTALL_PREFIX/var/ntp/ntp.log* >/dev/null 2>&1 || true
  129. exit 0