Thu, 04 Oct 2012 20:34:54 +0200
Import package vendor original spec for necessary manipulations.
ntp/fsl.ntp | file | annotate | diff | comparison | revisions | |
ntp/ntp.conf | file | annotate | diff | comparison | revisions | |
ntp/ntp.spec | file | annotate | diff | comparison | revisions | |
ntp/rc.ntp | file | annotate | diff | comparison | revisions |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ntp/fsl.ntp Thu Oct 04 20:34:54 2012 +0200 1.3 @@ -0,0 +1,16 @@ 1.4 +## 1.5 +## fsl.ntp -- OSSP fsl configuration 1.6 +## 1.7 + 1.8 +ident (ntp.*|dcfd|adjtimed)/.+ q{ 1.9 + prefix( 1.10 + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " 1.11 + ) 1.12 + -> { 1.13 + debug: file( 1.14 + path="@l_prefix@/var/ntp/ntp.log", 1.15 + perm=0644 1.16 + ) 1.17 + } 1.18 +}; 1.19 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/ntp/ntp.conf Thu Oct 04 20:34:54 2012 +0200 2.3 @@ -0,0 +1,20 @@ 2.4 +## 2.5 +## ntp.conf -- NTP Daemon Configuration 2.6 +## 2.7 + 2.8 +# global NTP daemon options 2.9 +logfile @l_prefix@/var/ntp/ntp.log 2.10 +pidfile @l_prefix@/var/ntp/ntpd.pid 2.11 +driftfile @l_prefix@/var/ntp/ntpd.drift 2.12 +statsdir @l_prefix@/var/ntp/ntpd.stat/ 2.13 + 2.14 +# list of NTP peers 2.15 +# (see http://www.pool.ntp.org/) 2.16 +server 0.pool.ntp.org iburst 2.17 +server 1.pool.ntp.org iburst 2.18 +server 2.pool.ntp.org iburst 2.19 + 2.20 +# restrictions 2.21 +restrict default limited noquery nomodify notrap nopeer 2.22 +restrict 127.0.0.0 mask 255.0.0.0 2.23 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/ntp/ntp.spec Thu Oct 04 20:34:54 2012 +0200 3.3 @@ -0,0 +1,204 @@ 3.4 +## 3.5 +## ntp.spec -- OpenPKG RPM Package Specification 3.6 +## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/> 3.7 +## 3.8 +## Permission to use, copy, modify, and distribute this software for 3.9 +## any purpose with or without fee is hereby granted, provided that 3.10 +## the above copyright notice and this permission notice appear in all 3.11 +## copies. 3.12 +## 3.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 3.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 3.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 3.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 3.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 3.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 3.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 3.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 3.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3.24 +## SUCH DAMAGE. 3.25 +## 3.26 + 3.27 +# package version 3.28 +%define V_major 4 3.29 +%define V_minor 2 3.30 +%define V_micro 6p5 3.31 + 3.32 +# package information 3.33 +Name: ntp 3.34 +Summary: Network Time Protocol (NTP) Daemon 3.35 +URL: http://www.ntp.org/ 3.36 +Vendor: David L. Mills 3.37 +Packager: OpenPKG Foundation e.V. 3.38 +Distribution: OpenPKG Community 3.39 +Class: CORE 3.40 +Group: Network 3.41 +License: BSD-style 3.42 +Version: %{V_major}.%{V_minor}.%{V_micro} 3.43 +Release: 20111226 3.44 + 3.45 +# package options 3.46 +%option with_fsl yes 3.47 +%option with_crypto yes 3.48 +%option with_sntp yes 3.49 +%option with_local yes 3.50 + 3.51 +# list of sources 3.52 +Source0: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp%{V_major}/ntp-%{version}.tar.gz 3.53 +Source1: ntp-doc.tar.gz 3.54 +Source2: ntp.conf 3.55 +Source3: rc.ntp 3.56 +Source4: fsl.ntp 3.57 + 3.58 +# build information 3.59 +BuildPreReq: OpenPKG, openpkg >= 20100101, make 3.60 +PreReq: OpenPKG, openpkg >= 20100101 3.61 +%if "%{with_fsl}" == "yes" 3.62 +BuildPreReq: fsl 3.63 +PreReq: fsl 3.64 +%endif 3.65 +%if "%{with_crypto}" == "yes" 3.66 +BuildPreReq: openssl, gcc 3.67 +PreReq: openssl 3.68 +%endif 3.69 + 3.70 +%description 3.71 + The Network Time Protocol (NTP) is used to synchronize the time 3.72 + of a computer client or server to another server or reference 3.73 + time source, such as a radio or satellite receiver or modem. It 3.74 + provides accuracies typically within a millisecond on LANs and 3.75 + up to a few tens of milliseconds on WANs relative to Coordinated 3.76 + Universal Time (UTC) via a Global Positioning Service (GPS) 3.77 + receiver, for example. Typical NTP configurations utilize multiple 3.78 + redundant servers and diverse network paths in order to achieve high 3.79 + accuracy and reliability. Some configurations include cryptographic 3.80 + authentication to prevent accidental or malicious protocol attacks 3.81 + and some provide automatic server discovery using IP multicast. 3.82 + 3.83 +%track 3.84 + prog ntp = { 3.85 + version = %{version} 3.86 + url = http://www.ntp.org/downloads.html 3.87 + regex = ntp-(\d+\.\d+\.\d+(p\d+)?)\.tar\.gz 3.88 + } 3.89 + 3.90 +%prep 3.91 + %setup -q 3.92 + %setup -q -T -D -a 1 3.93 + 3.94 +%build 3.95 + # configure program 3.96 + ( case "%{l_platform -t}" in 3.97 + *-netbsd* ) echo "ac_cv_header_sys_soundcard_h=no" >>config.cache ;; 3.98 + esac 3.99 + ) >config.cache 3.100 + %{l_shtool} subst \ 3.101 + -e 's;\(CFLAGS="$CFLAGS -W.*\);#\1;g' \ 3.102 + configure 3.103 + AUTOCONF=true \ 3.104 + AUTOMAKE=true \ 3.105 + ACLOCAL=true \ 3.106 + AUTOHEADER=true \ 3.107 + CC="%{l_cc}" \ 3.108 + CFLAGS="%{l_cflags -O}" \ 3.109 + LDFLAGS="%{l_fsl_ldflags}" \ 3.110 +%if "%{with_crypto}" == "yes" 3.111 + LIBS="%{l_fsl_libs} -lcrypto" \ 3.112 +%else 3.113 + LIBS="%{l_fsl_libs}" \ 3.114 +%endif 3.115 + ./configure \ 3.116 + --cache-file=./config.cache \ 3.117 + --prefix=%{l_prefix} \ 3.118 + --mandir=%{l_prefix}/man \ 3.119 +%if "%{with_sntp}" == "yes" 3.120 + --with-sntp \ 3.121 +%endif 3.122 +%if "%{with_local}" == "yes" 3.123 + --enable-LOCAL-CLOCK \ 3.124 +%endif 3.125 +%if "%{with_crypto}" == "yes" 3.126 + --with-crypto \ 3.127 + --with-openssl-libdir=%{l_prefix}/lib \ 3.128 + --with-openssl-incdir=%{l_prefix}/include \ 3.129 +%else 3.130 + --without-crypto \ 3.131 + --without-openssl-libdir \ 3.132 + --without-openssl-incdir \ 3.133 +%endif 3.134 + --enable-ntpdate-step \ 3.135 + --without-lineeditlibs \ 3.136 + --without-net-snmp-config \ 3.137 + --without-ntpsnmpd 3.138 + %{l_shtool} subst \ 3.139 + -e 's;\(CONFIG_FILE[^"]*"\)/etc/ntp.conf;\1%{l_prefix}/etc/ntp/ntp.conf;' \ 3.140 + include/ntp_config.h ntpdate/ntptime_config.c 3.141 + 3.142 + # build program 3.143 + %{l_make} %{l_mflags -O} 3.144 + 3.145 +%install 3.146 + # install program 3.147 + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" 3.148 + 3.149 + # install manual pages 3.150 + ( cd ntp-doc 3.151 + %{l_shtool} mkdir -f -p -m 755 \ 3.152 + $RPM_BUILD_ROOT%{l_prefix}/man/man5 3.153 + %{l_shtool} install -c -m 644 \ 3.154 + *.5 $RPM_BUILD_ROOT%{l_prefix}/man/man5/ 3.155 + %{l_shtool} mkdir -f -p -m 755 \ 3.156 + $RPM_BUILD_ROOT%{l_prefix}/man/man8 3.157 + %{l_shtool} install -c -m 644 *.8 \ 3.158 + $RPM_BUILD_ROOT%{l_prefix}/man/man8/ 3.159 + ) || exit $? 3.160 + 3.161 + # install default configuration 3.162 + %{l_shtool} mkdir -f -p -m 755 \ 3.163 + $RPM_BUILD_ROOT%{l_prefix}/etc/ntp 3.164 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 3.165 + %{SOURCE ntp.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/ntp/ 3.166 + 3.167 + # post-adjust installation 3.168 + %{l_shtool} mkdir -f -p -m 755 \ 3.169 + $RPM_BUILD_ROOT%{l_prefix}/var/ntp/ntpd.stat 3.170 + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true 3.171 + 3.172 + # install run-command script 3.173 + %{l_shtool} mkdir -f -p -m 755 \ 3.174 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 3.175 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 3.176 + %{SOURCE rc.ntp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 3.177 + 3.178 + # install OSSP fsl configuration 3.179 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 3.180 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 3.181 + %{SOURCE fsl.ntp} \ 3.182 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 3.183 + 3.184 + # determine installation files 3.185 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 3.186 + %{l_files_std} \ 3.187 + '%config %{l_prefix}/etc/fsl/fsl.ntp' \ 3.188 + '%config %{l_prefix}/etc/ntp/ntp.conf' 3.189 + 3.190 +%files -f files 3.191 + 3.192 +%clean 3.193 + 3.194 +%post 3.195 + # after upgrade, restart service 3.196 + [ $1 -eq 2 ] || exit 0 3.197 + eval `%{l_rc} ntp status 2>/dev/null` 3.198 + [ ".$ntp_active" = .yes ] && %{l_rc} ntp restart 3.199 + exit 0 3.200 + 3.201 +%preun 3.202 + # before erase, stop service and remove log files 3.203 + [ $1 -eq 0 ] || exit 0 3.204 + %{l_rc} ntp stop 2>/dev/null 3.205 + rm -f $RPM_INSTALL_PREFIX/var/ntp/ntp.log* >/dev/null 2>&1 || true 3.206 + exit 0 3.207 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/ntp/rc.ntp Thu Oct 04 20:34:54 2012 +0200 4.3 @@ -0,0 +1,99 @@ 4.4 +#!@l_prefix@/bin/openpkg rc 4.5 +## 4.6 +## rc.ntp -- Run-Commands 4.7 +## 4.8 + 4.9 +%config 4.10 + ntp_enable="$openpkg_rc_def" 4.11 + ntp_mode="daemon" 4.12 + ntp_daemon_flags="" 4.13 + ntp_log_prolog="true" 4.14 + ntp_log_epilog="true" 4.15 + ntp_log_numfiles="10" 4.16 + ntp_log_minsize="1M" 4.17 + ntp_log_complevel="9" 4.18 + 4.19 +%common 4.20 + ntp_pidfile=`grep "^pidfile" @l_prefix@/etc/ntp/ntp.conf | awk '{ printf("%s", $2); }'` 4.21 + ntp_signal () { 4.22 + [ -f $ntp_pidfile ] && kill -$1 `cat $ntp_pidfile` 4.23 + } 4.24 + ntp_once () { 4.25 + [ ".$1" != . ] && sleep $1 4.26 + @l_prefix@/bin/ntpd -q -g 4.27 + } 4.28 + 4.29 +%status -u @l_susr@ -o 4.30 + ntp_usable="unknown" 4.31 + ntp_active="no" 4.32 + rcService ntp enable yes && \ 4.33 + [ ".$ntp_mode" = ".daemon" ] && \ 4.34 + ntp_signal 0 && ntp_active="yes" 4.35 + echo "ntp_enable=\"$ntp_enable\"" 4.36 + echo "ntp_usable=\"$ntp_usable\"" 4.37 + echo "ntp_active=\"$ntp_active\"" 4.38 + 4.39 +%start -p 200 -u @l_susr@ 4.40 + rcService ntp enable yes || exit 0 4.41 + rcService ntp active yes && exit 0 4.42 + 4.43 + # under both periodical and daemon mode, synchronize local machine 4.44 + # once manually -- either to fill the gap between startup time and 4.45 + # the first run of the cron jobs (periodical mode) or to perform 4.46 + # a possible large time offset which ntpd does not perform itself 4.47 + # (daemon mode). 4.48 + case "$ntp_mode" in 4.49 + once | \ 4.50 + daemon | \ 4.51 + quarterly | hourly | daily | weekly | monthly ) 4.52 + ntp_once 4.53 + ;; 4.54 + esac 4.55 + 4.56 + # run the NTP daemon for continued synchronization 4.57 + if [ ".$ntp_mode" = .daemon ]; then 4.58 + @l_prefix@/bin/ntpd ${ntp_daemon_flags} 4.59 + fi 4.60 + 4.61 +%stop -p 800 -u @l_susr@ 4.62 + rcService ntp enable yes || exit 0 4.63 + rcService ntp active no && exit 0 4.64 + ntp_signal TERM 4.65 + rm -f $ntp_pidfile 2>/dev/null || true 4.66 + 4.67 +%restart -p 200 -u @l_susr@ 4.68 + rcService ntp enable yes || exit 0 4.69 + rcService ntp active no && exit 0 4.70 + rc ntp stop start 4.71 + 4.72 +%quarterly -p 800 -u @l_susr@ 4.73 + rcService ntp enable yes || exit 0 4.74 + [ ".$ntp_mode" = .quarterly ] && ntp_once 30 4.75 + exit 0 4.76 + 4.77 +%hourly -p 800 -u @l_susr@ 4.78 + rcService ntp enable yes || exit 0 4.79 + [ ".$ntp_mode" = .hourly ] && ntp_once 30 4.80 + exit 0 4.81 + 4.82 +%daily -p 800 -u @l_susr@ 4.83 + rcService ntp enable yes || exit 0 4.84 + [ ".$ntp_mode" = .daily ] && ntp_once 30 4.85 + shtool rotate -f \ 4.86 + -n ${ntp_log_numfiles} -s ${ntp_log_minsize} -d \ 4.87 + -z ${ntp_log_complevel} -m 644 -o @l_susr@ -g @l_mgrp@ \ 4.88 + -P "${ntp_log_prolog}" \ 4.89 + -E "${ntp_log_epilog}; rc ntp restart" \ 4.90 + @l_prefix@/var/ntp/ntp.log 4.91 + exit 0 4.92 + 4.93 +%weekly -p 800 -u @l_susr@ 4.94 + rcService ntp enable yes || exit 0 4.95 + [ ".$ntp_mode" = .weekly ] && ntp_once 30 4.96 + exit 0 4.97 + 4.98 +%monthly -p 800 -u @l_susr@ 4.99 + rcService ntp enable yes || exit 0 4.100 + [ ".$ntp_mode" = .monthly ] && ntp_once 30 4.101 + exit 0 4.102 +