]> git.pld-linux.org Git - packages/ntp.git/commitdiff
- rel 2 auto/th/ntp-4_2_6p5-2
authorJan Rękorajski <baggins@pld-linux.org>
Tue, 14 Feb 2012 16:56:07 +0000 (16:56 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- added systemd support
- always use ntp user
- seperate back upstart support

Changed files:
    ntp-client.sysconfig -> 1.9
    ntp.init -> 1.29
    ntp.spec -> 1.155
    ntp.sysconfig -> 1.9
    ntpd.service -> 1.1
    ntpdate.service -> 1.1

ntp-client.sysconfig
ntp.init
ntp.spec
ntp.sysconfig
ntpd.service [new file with mode: 0644]
ntpdate.service [new file with mode: 0644]

index 6c8037c212920353016fc99dd384a9c7d80ab621..28d68d9817137ec5fb7615ca99961546405f8d8b 100644 (file)
@@ -5,9 +5,6 @@ NTPDATE_OPTIONS="-o 1 -u"
 #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 afab09c50c71b0d8717534fb853e05977c266320..b569e6f445004bf68ebf458c0560fe32f326502e 100644 (file)
--- a/ntp.init
+++ b/ntp.init
@@ -14,9 +14,6 @@ upstart_controlled
 # 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 @@ start() {
        # 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 d655420e05cd64e9d2efa1c9cc609517643ad999..84fa908b6a69c913fd4fe9862693c76e8ae62763 100644 (file)
--- a/ntp.spec
+++ b/ntp.spec
@@ -11,7 +11,7 @@ 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.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
@@ -26,6 +26,9 @@ Source7:      %{name}-manpages.tar.gz
 # 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
@@ -105,7 +108,6 @@ Provides:   ntpdaemon
 Provides:      user(ntp)
 Obsoletes:     ntp < 4.2.4p8-6
 Obsoletes:     ntpdaemon
-Obsoletes:     ntpd-upstart
 Obsoletes:     openntpd
 Obsoletes:     xntp3
 
@@ -134,6 +136,19 @@ referência de horário. Este pacote contém utilitários e servidores que
 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)
@@ -163,6 +178,19 @@ servers.
 %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
@@ -258,7 +286,8 @@ CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
 
 %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
@@ -271,6 +300,11 @@ cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/ntpd
 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
@@ -278,7 +312,7 @@ touch $RPM_BUILD_ROOT/var/lib/ntp/drift
 
 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}
@@ -294,6 +328,7 @@ rm -rf $RPM_BUILD_ROOT
 %post -n ntpd
 /sbin/chkconfig --add ntpd
 %service ntpd restart "NTP Daemon"
+%systemd_post ntpd.service
 
 %preun -n ntpd
 if [ "$1" = "0" ]; then
@@ -301,13 +336,20 @@ if [ "$1" = "0" ]; then
        /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
@@ -316,18 +358,27 @@ fi
 %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
@@ -340,12 +391,21 @@ sed -i -e 's,/etc/ntp/drift,/var/lib/ntp/drift,' %{_sysconfdir}/ntp.conf
 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)
@@ -354,7 +414,7 @@ fi
 %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
@@ -372,16 +432,25 @@ fi
 %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
index 6688f86525a367b96e7fc8410f61aaa6e7105b0f..63d175588abae8473ea0b003d4b8499be52c46a1 100644 (file)
@@ -6,6 +6,3 @@ SERVICE_RUN_NICE_LEVEL="+1"
 # 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"
diff --git a/ntpd.service b/ntpd.service
new file mode 100644 (file)
index 0000000..03f38ed
--- /dev/null
@@ -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
diff --git a/ntpdate.service b/ntpdate.service
new file mode 100644 (file)
index 0000000..1ed031b
--- /dev/null
@@ -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
This page took 0.126984 seconds and 4 git commands to generate.