LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File project.diff of Package ntp (Project home:dnh)

--- ntp.spec.orig
+++ ntp.spec
@@ -17,7 +17,7 @@
 
 
 %define ntpfaqversion 3.4
-%if %{undefined _ntpunitsdir}
+%if %{undefined _ntpunitsdir} && 0%{?_suse_version} >= 1220
 %global _ntpunitsdir %{_libexecdir}/systemd/ntp-units.d
 %endif
 Name:           ntp
@@ -39,6 +39,7 @@ Source6:        conf.ntp.reg
 Source7:        %{name}.firewall
 Source8:        conf.start-ntpd
 Source9:        conf.ntp-wait.service
+Source42:       ntp.init
 # documentation
 Source10:       NTP-FAQ-%{ntpfaqversion}.tar.bz2
 Source12:       README.SUSE
@@ -59,20 +60,22 @@ Patch23:        ntp-processname.patch
 Patch24:        ntp-daemonize.patch
 
 BuildRequires:  autoconf
-BuildRequires:  avahi-compat-mDNSResponder-devel
+#BuildRequires:  avahi-compat-mDNSResponder-devel
 BuildRequires:  fdupes
 BuildRequires:  libcap-devel
 BuildRequires:  libtool
 BuildRequires:  openssl-devel
 BuildRequires:  pps-tools-devel
 BuildRequires:  readline-devel
+%if 0%{?_suse_version} >= 1220
 BuildRequires:  pkgconfig(systemd)
+%endif
 Requires:       /bin/logger
 Requires:       timezone
 Requires(pre):  %fillup_prereq
-Requires(pre):  %{_bindir}/chkconfig
-Requires(pre):  %{_bindir}/diff
-Requires(pre):  %{_bindir}/grep
+Requires(pre):  /sbin/chkconfig
+Requires(pre):  diffutils
+Requires(pre):  grep
 Requires(pre):  pwdutils
 Suggests:       logrotate
 Provides:       ntp-daemon
@@ -81,7 +84,9 @@ Provides:       xntp3 = %{version}
 Obsoletes:      xntp < %{version}
 Obsoletes:      xntp3 < %{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+%if 0%{?_suse_version} >= 1220
 %{?systemd_requires}
+%endif
 Conflicts:      openntpd
 
 %description
@@ -166,7 +171,7 @@ export LDFLAGS="-pie"
 	--without-threads \
 	--enable-ntp-signd
 
-make %{?_smp_mflags}
+make V=1 %{?_smp_mflags}
 
 %install
 make DESTDIR=%{buildroot} install %{?_smp_mflags}
@@ -179,17 +184,26 @@ chmod 644 html/pic/neoclock4x.gif
 install -d %{buildroot}%{_localstatedir}/lib/ntp/{drift,etc,var/{lib,run/ntp},dev}
 install -d %{buildroot}%{_localstatedir}/run
 ln -s ../.. %{buildroot}%{_localstatedir}/lib/ntp%{_localstatedir}/lib/ntp
+
+%if 0%{?_suse_version} < 1220
+install -m 0755 -D %{SOURCE42} %{buildroot}/etc/init.d/ntp
+%__install -m 0755 -d %{buildroot}%{_sbindir}
+ln -s /etc/init.d/ntp %{buildroot}%{_sbindir}/rcntp
+%else
 ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcntpd
 ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcntp-wait
+%endif
 install -m 644 -D %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/ntp
 install -m 600 -D %{SOURCE2} %{buildroot}%{_sysconfdir}/ntp.conf
 install -m 600 -D %{SOURCE2} %{buildroot}%{_localstatedir}/lib/ntp%{_sysconfdir}/ntp.conf.iburst
 #
 # boot scripts
 #
+install -d %{buildroot}%{_prefix}/sbin
+%if 0%{?_suse_version} >= 1220
 install -m 0644 -D %{SOURCE3} %{buildroot}/%{_unitdir}/ntpd.service
 install -m 0644 -D %{SOURCE9} %{buildroot}/%{_unitdir}/ntp-wait.service
-install -d %{buildroot}%{_prefix}/sbin
+%else
 install -m 755 -D %{SOURCE8} %{buildroot}%{_sbindir}/start-ntpd
 %__install -d %{buildroot}/usr/lib/initscripts/legacy-actions/ntpd
 for f in ntptimeset addserver; do
@@ -200,6 +214,7 @@ for f in ntptimeset addserver; do
 	EOF
 	chmod 755 $F
 done
+%endif
 #
 # fillup sysconfig.ntp
 #
@@ -236,25 +251,34 @@ install -m 755 scripts/ntp-wait/ntp-wait
 install -d %{buildroot}/var/db
 install -m 644 /dev/null %{buildroot}/var/db/ntp-kod
 
+%if 0%{?_suse_version} >= 1220
 %if %{defined _ntpunitsdir}
 install -d %{buildroot}%{_ntpunitsdir}
 echo ntpd.service > %{buildroot}%{_ntpunitsdir}/50-ntp.list
 %endif
+%endif
 
 %pre
 %{_sbindir}/groupadd -r ntp 2> /dev/null || :
 %{_sbindir}/useradd -r -o -g ntp -u 74 -s /bin/false -c "NTP daemon" -d %{_localstatedir}/lib/ntp ntp 2> /dev/null || :
 %{_sbindir}/usermod -g ntp ntp 2>/dev/null || :
 test -L %{_localstatedir}/run/ntp  || rm -rf %{_localstatedir}/run/ntp && :
+
+%if 0%{?_suse_version} >= 1220
 %service_add_pre ntp.service ntpd.service
 %service_add_pre ntp-wait.service
 if [ $FIRST_ARG -ne 1 -a ! -e "%{_localstatedir}/lib/systemd/migrated/ntpd" -a -e %{_localstatedir}/lib/systemd/sysv-convert/database ]; then
   sed -i -e 's,ntp\t,ntpd\t,g' %{_localstatedir}/lib/systemd/sysv-convert/database
 fi
+%endif
 
 %preun
+%if 0%{?_suse_version} < 1220
+%stop_on_removal ntp
+%else
 %service_del_preun ntpd.service
 %service_del_preun ntp-wait.service
+%endif
 
 # no update? Then remove these files that aren't owned by the package
 if [ ${FIRST_ARG:-0} -eq 0 ]; then
@@ -306,29 +330,47 @@ fi
 if [ -f %{_localstatedir}/lib/ntp%{_sysconfdir}/ntp.conf.iburst ]; then
   chown --from=ntp:root root:ntp %{_localstatedir}/lib/ntp%{_sysconfdir}/ntp.conf.iburst
 fi
+
+%if 0%{?_suse_version} < 1220
+if /sbin/chkconfig -c ntpd 3 ; then
+	%{insserv_force_if_yast ntp}
+fi
+%endif
+
 %{fillup_only -n ntp }
 %{fillup_only -n syslog }
 if [ ! -f %{_localstatedir}/log/ntp ]; then
 	touch %{_localstatedir}/log/ntp
 	chmod 644 %{_localstatedir}/log/ntp
 fi
+%if 0%{?_suse_version} >= 1220
 %service_add_post ntpd.service
 %service_add_post ntp-wait.service
 if [ ! -e "%{_localstatedir}/lib/systemd/migrated/ntpd" ]; then
   touch %{_localstatedir}/lib/systemd/migrated/ntpd
 fi
+%endif
 
 %postun
+%if 0%{?_suse_version} < 1220
+%restart_on_update ntp
+%insserv_cleanup
+%else
 %service_del_postun ntpd.service
 %service_del_postun ntp-wait.service
+%endif
 
 %files
 %defattr(-,root,root)
 %doc COPYRIGHT ChangeLog NEWS README* TODO WHERE-TO-START conf
 %attr(0640,root,ntp) %config(noreplace) %{_sysconfdir}/ntp.conf
 %dir %{_sysconfdir}/slp.reg.d
+%if 0%{?_suse_version} < 1220
+/etc/init.d/ntp
+%else
 %{_unitdir}/ntpd.service
 %{_unitdir}/ntp-wait.service
+%endif
 %if %{defined _ntpunitsdir}
 %{_ntpunitsdir}/50-ntp.list
 %endif
@@ -356,7 +398,8 @@ fi
 %attr(0755,ntp,root) %{_localstatedir}/lib/ntp%{_localstatedir}/run/ntp
 %ghost %config(noreplace) %{_localstatedir}/log/ntp
 %{_datadir}/omc/svcinfo.d/ntp.xml
-/var/db
+%dir /var/db
+/var/db/ntp-kod
 
 %files doc
 %defattr(-,root,root)