packages: ntp/ntp-client.sysconfig, ntp/ntp.init, ntp/ntp.spec, ntp/ntp.sys...

baggins baggins at pld-linux.org
Tue Feb 14 17:56:12 CET 2012


Author: baggins                      Date: Tue Feb 14 16:56:12 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- rel 2
- added systemd support
- always use ntp user
- seperate back upstart support

---- Files affected:
packages/ntp:
   ntp-client.sysconfig (1.8 -> 1.9) , ntp.init (1.28 -> 1.29) , ntp.spec (1.154 -> 1.155) , ntp.sysconfig (1.8 -> 1.9) , ntpd.service (NONE -> 1.1)  (NEW), ntpdate.service (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/ntp/ntp-client.sysconfig
diff -u packages/ntp/ntp-client.sysconfig:1.8 packages/ntp/ntp-client.sysconfig:1.9
--- packages/ntp/ntp-client.sysconfig:1.8	Fri Jan 22 20:40:54 2010
+++ packages/ntp/ntp-client.sysconfig	Tue Feb 14 17:56:07 2012
@@ -5,9 +5,6 @@
 #NTPDATE_SERVERS="ntp.certum.pl vega.cbk.poznan.pl"
 NTPDATE_SERVERS="pool.ntp.org"
 
-# switch user to this user when running ntpdate(1)
-NTPDATE_USER="ntp"
-
 # Set to 'yes' to sync hw clock after successful ntpdate
 SYNC_HWCLOCK="no"
 

================================================================
Index: packages/ntp/ntp.init
diff -u packages/ntp/ntp.init:1.28 packages/ntp/ntp.init:1.29
--- packages/ntp/ntp.init:1.28	Sat Jul 30 15:33:09 2011
+++ packages/ntp/ntp.init	Tue Feb 14 17:56:07 2012
@@ -14,9 +14,6 @@
 # Source networking configuration.
 . /etc/sysconfig/network
 
-# default user if not overriden by config
-NTPD_USER="ntp"
-
 # Source ntp configuration
 . /etc/sysconfig/ntpd
 
@@ -36,7 +33,7 @@
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/ntpd ]; then
 		msg_starting "ntpd"
-		daemon /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid ${NTPD_USER:+-u $NTPD_USER} $NTPD_OPTIONS
+		daemon /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid -u ntp:ntp $NTPD_OPTIONS
 		RETVAL=$?
 		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
 	else

================================================================
Index: packages/ntp/ntp.spec
diff -u packages/ntp/ntp.spec:1.154 packages/ntp/ntp.spec:1.155
--- packages/ntp/ntp.spec:1.154	Sat Dec 31 13:42:08 2011
+++ packages/ntp/ntp.spec	Tue Feb 14 17:56:07 2012
@@ -12,7 +12,7 @@
 Summary(pt_BR.UTF-8):	Network Time Protocol versão 4
 Name:		ntp
 Version:	4.2.6p5
-Release:	1
+Release:	2
 License:	distributable
 Group:		Networking/Daemons
 Source0:	http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
@@ -27,6 +27,9 @@
 # Source7-md5:	208fcc9019e19ab26d28e4597290bffb
 Source8:	ntp.upstart
 Source9:	ntpdate.upstart
+Source10:	ntpdate-wrapper
+Source11:	ntpd.service
+Source12:	ntpdate.service
 Patch0:		%{name}-time.patch
 Patch1:		%{name}-no_libelf.patch
 Patch2:		%{name}-ipv6.patch
@@ -106,7 +109,6 @@
 Provides:	user(ntp)
 Obsoletes:	ntp < 4.2.4p8-6
 Obsoletes:	ntpdaemon
-Obsoletes:	ntpd-upstart
 Obsoletes:	openntpd
 Obsoletes:	xntp3
 
@@ -135,6 +137,19 @@
 sincronizarão o relógio do seu computador com o horário universal
 (UTC) através do protocolo NTP e utilizando servidores NTP públicos.
 
+%package -n ntpd-upstart
+Summary:	Upstart job description for the NTP daemon
+Summary(pl.UTF-8):	Opis zadania Upstart dla demona NTP
+Group:		Daemons
+Requires:	ntpd = %{version}-%{release}
+Requires:	upstart >= 0.6
+
+%description -n ntpd-upstart
+Upstart job description for the NTP daemon.
+
+%description -n ntpd-upstart -l pl.UTF-8
+Opis zadania Upstart dla demona NTP.
+
 %package -n ntpdate
 Summary:	Utility to set the date and time via NTP
 Summary(pl.UTF-8):	Klient do synchronizacji czasu po NTP (Network Time Protocol)
@@ -164,6 +179,19 @@
 %description -n ntpdate -l pl.UTF-8
 Klient do synchronizacji czasu po NTP (Network Time Protocol).
 
+%package -n ntpdate-upstart
+Summary:	Upstart job description for NTP client
+Summary(pl.UTF-8):	Opis zadania Upstart dla klienta NTP
+Group:		Daemons
+Requires:	ntpdate = %{version}-%{release}
+Requires:	upstart >= 0.6
+
+%description -n ntpdate-upstart
+Upstart job description for the NTP client.
+
+%description -n ntpdate-upstart -l pl.UTF-8
+Opis zadania Upstart dla klienta NTP.
+
 %package -n mibs-ntp
 Summary:	MIBs for NTP time entities
 Group:		Applications/System
@@ -259,7 +287,8 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/{rc.d/init.d,sysconfig,cron.hourly,init},%{_mandir}/man1}
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1,%{systemdunitdir}} \
+	$RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.hourly,init}
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
@@ -272,6 +301,11 @@
 cp -a %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/ntpdate
 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/init/ntpd.conf
 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/init/ntpdate.conf
+
+install %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}/ntpdate-wrapper
+install %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}/ntpd.service
+install %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/ntpdate.service
+
 cp -a man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
 
 install -d $RPM_BUILD_ROOT/var/lib/ntp
@@ -279,7 +313,7 @@
 
 cat > $RPM_BUILD_ROOT/etc/cron.hourly/ntpdate <<'EOF'
 #!/bin/sh
-exec /sbin/service ntpdate cronsettime
+exec /usr/sbin/ntpdate-wrapper
 EOF
 
 install -d $RPM_BUILD_ROOT%{mibdir}
@@ -295,6 +329,7 @@
 %post -n ntpd
 /sbin/chkconfig --add ntpd
 %service ntpd restart "NTP Daemon"
+%systemd_post ntpd.service
 
 %preun -n ntpd
 if [ "$1" = "0" ]; then
@@ -302,13 +337,20 @@
 	/sbin/chkconfig --del ntpd
 	rm -f /var/lib/ntp/drift
 fi
+%systemd_preun ntpd.service
 
 %postun -n ntp
 if [ "$1" = "0" ]; then
 	%userremove ntp
 	%groupremove ntp
 fi
+%systemd_reload
+
+%post -n ntpd-upstart
+%upstart_post ntpd
 
+%postun -n ntpd-upstart
+%upstart_postun ntpd
 
 %pre -n ntpdate
 %groupadd -g 246 ntp
@@ -317,18 +359,27 @@
 %post -n ntpdate
 /sbin/chkconfig --add ntpdate
 %service ntpdate restart "NTP Date"
+%systemd_post ntpdate.service
 
 %preun -n ntpdate
 if [ "$1" = "0" ]; then
 	%service ntpdate stop
 	/sbin/chkconfig --del ntpdate
 fi
+%systemd_preun ntpdate.service
 
 %postun -n ntpdate
 if [ "$1" = "0" ]; then
 	%userremove ntp
 	%groupremove ntp
 fi
+%systemd_reload
+
+%post -n ntpdate-upstart
+%upstart_post ntpdate
+
+%postun -n ntpdate-upstart
+%upstart_postun ntpdate
 
 %triggerun -n ntpd -- ntp < 4.2.4p8-3.14
 # Prevent preun from ntp from working
@@ -341,12 +392,21 @@
 mv -f /etc/ntp/ntp.drift /var/lib/ntp/drift 2>/dev/null
 mv -f /etc/ntp/drift /var/lib/ntp/drift 2>/dev/null
 %service -q ntpd restart
+%systemd_trigger ntpd.service
+%systemd_post ntpdate
+
+%triggerpostun -n ntpd -- ntpd < 4.2.6p5-2
+%systemd_trigger ntpd.service
 
 %triggerpostun -n ntpdate -- ntp-client < 4.2.4p8-3.2
 if [ -f /etc/sysconfig/ntp.rpmsave ]; then
 	cp -f /etc/sysconfig/ntpdate{,.rpmnew}
 	mv -f /etc/sysconfig/ntp.rpmsave /etc/sysconfig/ntpdate
 fi
+%systemd_trigger ntpdate.service
+
+%triggerpostun -n ntpdate -- ntpdate < 4.2.6p5-2
+%systemd_trigger ntpdate.service
 
 %files -n ntpd
 %defattr(644,root,root,755)
@@ -355,7 +415,7 @@
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpd
 %attr(754,root,root) /etc/rc.d/init.d/ntpd
-%config(noreplace) %verify(not md5 mtime size) /etc/init/ntpd.conf
+%{systemdunitdir}/ntpd.service
 %attr(755,root,root) %{_sbindir}/ntpd
 %attr(755,root,root) %{_sbindir}/ntpdc
 %attr(755,root,root) %{_sbindir}/ntp-keygen
@@ -373,16 +433,25 @@
 %dir %attr(770,root,ntp) /var/lib/ntp
 %attr(640,ntp,ntp) %ghost /var/lib/ntp/drift
 
+%files -n ntpd-upstart
+%defattr(644,root,root,755)
+%config(noreplace) %verify(not md5 mtime size) /etc/init/ntpd.conf
+
 %files -n ntpdate
 %defattr(644,root,root,755)
 %doc COPYRIGHT
 %attr(755,root,root) %{_sbindir}/ntpdate
+%attr(755,root,root) %{_sbindir}/ntpdate-wrapper
 %attr(754,root,root) /etc/rc.d/init.d/ntpdate
-%config(noreplace) %verify(not md5 mtime size) /etc/init/ntpdate.conf
 %attr(754,root,root) /etc/cron.hourly/ntpdate
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
+%{systemdunitdir}/ntpdate.service
 %{_mandir}/man1/ntpdate*
 
+%files -n ntpdate-upstart
+%defattr(644,root,root,755)
+%config(noreplace) %verify(not md5 mtime size) /etc/init/ntpdate.conf
+
 %files -n mibs-ntp
 %defattr(644,root,root,755)
 %{mibdir}/ntpv4-mib.mib
@@ -409,6 +478,12 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.155  2012/02/14 16:56:07  baggins
+- rel 2
+- added systemd support
+- always use ntp user
+- seperate back upstart support
+
 Revision 1.154  2011/12/31 12:42:08  adamg
 - drop obsolete patches, renumbered fc patches
 

================================================================
Index: packages/ntp/ntp.sysconfig
diff -u packages/ntp/ntp.sysconfig:1.8 packages/ntp/ntp.sysconfig:1.9
--- packages/ntp/ntp.sysconfig:1.8	Fri Jan 22 20:40:54 2010
+++ packages/ntp/ntp.sysconfig	Tue Feb 14 17:56:07 2012
@@ -6,6 +6,3 @@
 # pass additional arguments (like -g)
 #NTPD_OPTIONS="-l /var/log/ntpd.log" # this demands logrotate to avoid problems
 NTPD_OPTIONS=""
-
-# switch user to this user when running ntpd(1)
-NTPD_USER="ntp"

================================================================
Index: packages/ntp/ntpd.service
diff -u /dev/null packages/ntp/ntpd.service:1.1
--- /dev/null	Tue Feb 14 17:56:12 2012
+++ packages/ntp/ntpd.service	Tue Feb 14 17:56:07 2012
@@ -0,0 +1,11 @@
+[Unit]
+Description=Network Time Service
+After=syslog.target ntpdate.service
+
+[Service]
+EnvironmentFile=/etc/sysconfig/ntpd
+ExecStart=/usr/sbin/ntpd -n -u ntp:ntp -c /etc/ntp/ntp.conf $NTPD_OPTIONS
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target

================================================================
Index: packages/ntp/ntpdate.service
diff -u /dev/null packages/ntp/ntpdate.service:1.1
--- /dev/null	Tue Feb 14 17:56:12 2012
+++ packages/ntp/ntpdate.service	Tue Feb 14 17:56:07 2012
@@ -0,0 +1,13 @@
+[Unit]
+Description=Set time via NTP
+After=syslog.target network.target
+Before=time-sync.target
+Wants=time-sync.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/ntpdate-wrapper
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp-client.sysconfig?r1=1.8&r2=1.9&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp.init?r1=1.28&r2=1.29&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp.spec?r1=1.154&r2=1.155&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp.sysconfig?r1=1.8&r2=1.9&f=u



More information about the pld-cvs-commit mailing list