# Check that networking is up.
if is_yes "${NETWORKING}"; then
if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
- msg_network_down ntp
+ msg_network_down "ntpdate"
exit 1
fi
else
fi
start() {
- show "Syncing time with ntpdate (backgrounding)"
- daemon --fork /usr/sbin/ntpdate -s $NTPDATE_OPTIONS $NTPDATE_SERVERS
+ show "Syncing time with ntpdate"
+ daemon /usr/sbin/ntpdate -s $NTPDATE_OPTIONS $NTPDATE_SERVERS
RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpdate
+ if [ $RETVAL -eq 0 ]; then
+ touch /var/lock/subsys/ntpdate
+ if is_yes "$SYNC_HWCLOCK"; then
+ show "Syncing hardware clock to system time"
+ /sbin/hwclock --systohc && ok || fail
+ fi
+ fi
}
stop() {
# Sync time at startup
-NTPDATE_OPTIONS="-o 1 -u"
+NTPDATE_OPTIONS="-o 1 -u -U ntp"
+
#NTPDATE_SERVERS="ntp.nasa.gov clock.isc.org"
#NTPDATE_SERVERS="ntp.certum.pl vega.cbk.poznan.pl"
NTPDATE_SERVERS="pool.ntp.org"
+# Set to 'yes' to sync hw clock after successful ntpdate
+SYNC_HWCLOCK="no"
+
# also run ntpdate from cron
NTPDATE_CRON="yes"
# TODO
-# - run as ntp/ntp (fc patches)
-# - default config is too restrictive (ntpq -p should work locally)
+# - see if ntpd can be droproot too as ntpdate is patched
+# - ntpd default config is too restrictive (ntpq -p should work locally)
%include /usr/lib/rpm/macros.perl
Summary: Network Time Protocol utilities
Summary(pl.UTF-8): Narzędzia do synchronizacji czasu (Network Time Protocol)
Summary(pt_BR.UTF-8): Network Time Protocol versão 4
Name: ntp
Version: 4.2.4p8
-Release: 3.2
+Release: 3.3
License: distributable
Group: Daemons
Source0: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
Summary(pl.UTF-8): Klient do synchronizacji czasu po NTP (Network Time Protocol)
Group: Applications/Networking
Requires(post,preun): /sbin/chkconfig
-Provides: ntpclient
-Obsoletes: ntpclient
+Provides: group(ntp)
+Provides: user(ntp)
Conflicts: ntp < 4.2.0-3
# for upgrades
Provides: ntp-client = %{version}-%{release}
Obsoletes: ntp-client < 4.2.4p8-4
+# virtual
+Provides: ntpclient
+Obsoletes: ntpclient
%description -n ntpdate
ntpdate is a program for retrieving the date and time from NTP
if [ "$1" = "0" ]; then
%service ntpd stop
/sbin/chkconfig --del ntpd
- rm -f /etc/ntp/drift
+ rm -f %{_sysconfdir}/drift
fi
+%pre -n ntpdate
+%groupadd -g 246 ntp
+%useradd -u 246 -d %{_sysconfdir} -g ntp -c "NTP Daemon" ntp
+
%post -n ntpdate
/sbin/chkconfig --add ntpdate
%service ntpdate restart "NTP Date"
/sbin/chkconfig --del ntpdate
fi
+%postun -n ntpdate
+if [ "$1" = "0" ]; then
+ %userremove ntp
+ %groupremove ntp
+fi
+
%triggerpostun -n ntpd -- ntp < 4.2.4p8-3.1
%triggerpostun -n ntpdate -- ntp-client < 4.2.4p8-3.2
if [ -f /etc/sysconfig/ntp.rpmsave ]; then