From f16919c0b47aeedf44db5adbb874dff96962470d34a82f3bb760d46d2eeeb805 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 26 Oct 2017 08:03:18 +0000 Subject: [PATCH 1/4] Accepting request 536441 from home:markkp:branches:network:time - Modified the spec file to comment out the pool statement in chrony.conf if _not_ building for openSUSE. (bsc#1063704). OBS-URL: https://build.opensuse.org/request/show/536441 OBS-URL: https://build.opensuse.org/package/show/network:time/chrony?expand=0&rev=33 --- chrony.changes | 6 ++++++ chrony.spec | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/chrony.changes b/chrony.changes index 4d639b2..95f19fb 100644 --- a/chrony.changes +++ b/chrony.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Oct 24 18:23:56 UTC 2017 - mpost@suse.com + +- Modified the spec file to comment out the pool statement + in chrony.conf if _not_ building for openSUSE. (bsc#1063704). + ------------------------------------------------------------------- Thu Sep 28 16:17:08 UTC 2017 - mrueckert@suse.de diff --git a/chrony.spec b/chrony.spec index 57b3992..324e895 100644 --- a/chrony.spec +++ b/chrony.spec @@ -25,6 +25,10 @@ %bcond_with systemd %bcond_with syscallfilter %endif +# If is_opensuse is not defined, then this is an older version of SLES +# or some other distribution. So, if not defined then define it as 0 +%if 0%{!?is_opensuse:%global is_opensuse 0} +%endif Name: chrony Version: 3.2 Release: 0 @@ -107,9 +111,16 @@ or a different computer. %patch2 -p1 %patch5 -p1 -# use our vendor zone (2.*pool.ntp.org names include IPv6 addresses) +# If this is an openSUSE build, use our vendor zone +# (2.*pool.ntp.org names include IPv6 addresses). If not +# an openSUSE build, comment out the pool statement +%if %{is_opensuse} sed -e 's|^\(pool \)\(pool.ntp.org\)|\12.%{vendorzone}\2|' \ < examples/chrony.conf.example2 > chrony.conf +%else +sed -e 's|^\pool|! pool|' \ + < examples/chrony.conf.example2 > chrony.conf +%endif touch -r examples/chrony.conf.example2 chrony.conf From 9a79f15b95ef5b136092ce1b2201767a114a7e440b7f0ee79d2bccef83ef00de Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 26 Oct 2017 11:15:56 +0000 Subject: [PATCH 2/4] - Cleanup spec file: * Drop pre systemd support * Run spec-cleaner OBS-URL: https://build.opensuse.org/package/show/network:time/chrony?expand=0&rev=34 --- chrony.changes | 7 +++ chrony.init | 114 ------------------------------------------------- chrony.spec | 112 ++++++++++++++---------------------------------- 3 files changed, 39 insertions(+), 194 deletions(-) delete mode 100644 chrony.init diff --git a/chrony.changes b/chrony.changes index 95f19fb..13eb6ce 100644 --- a/chrony.changes +++ b/chrony.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Oct 26 10:39:11 UTC 2017 - mpluskal@suse.com + +- Cleanup spec file: + * Drop pre systemd support + * Run spec-cleaner + ------------------------------------------------------------------- Tue Oct 24 18:23:56 UTC 2017 - mpost@suse.com diff --git a/chrony.init b/chrony.init deleted file mode 100644 index 3eb0df5..0000000 --- a/chrony.init +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/sh -# -# openSUSE system startup script for chronyd -# Copyright (C) 2010 Pascal Bleser -# -# This library is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or (at -# your option) any later version. -# -# This library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, -# USA. -# -# /etc/init.d/chronyd -# and its symbolic link -# /usr/sbin/rcchronyd -# -### BEGIN INIT INFO -# Provides: chronyd -# Required-Start: $syslog $remote_fs $network $time -# Should-Start: $time ypbind -# Required-Stop: $syslog $remote_fs $network $time -# Should-Stop: ypbind -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Chrony daemon providing system clock synchronization -# Description: Start the chrony daemon to manage the system clock -### END INIT INFO - -SERVICE=chronyd - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -CHRONYD_BIN=/usr/sbin/FOO -test -x "$CHRONYD_BIN" || { echo "$CHRONYD_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -# Check for existence of needed config file and read it -CHRONYD_CONFIG="/etc/sysconfig/chronyd" -test -r "$CHRONYD_CONFIG" || { echo "$CHRONYD_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -# Read config -. "$CHRONYD_CONFIG" - -CHRONYD_USER=chrony - -. /etc/rc.status -rc_reset # Reset status of this service - -case "$1" in - start) - CHRONY_OPTIONS="" - [ "$CHRONY_IPV4" = "yes" -a "$CHRONY_IPV6" = "no" ] && CHRONY_OPTIONS="$CHRONY_OPTIONS -4" - [ "$CHRONY_IPV4" = "no" -a "$CHRONY_IPV6" = "yes" ] && CHRONY_OPTIONS="$CHRONY_OPTIONS -6" - [ "$CHRONY_LOCK_IN_RAM" = "yes" ] && CHRONY_OPTIONS="$CHRONY_OPTIONS -m" - echo -n "Starting $SERVICE " - /sbin/startproc "$CHRONYD_BIN" -u "$CHRONYD_USER" $CHRONY_OPTIONS - rc_status -v - ;; - stop) - echo -n "Shutting down $SERVICE " - /sbin/killproc -TERM "$CHRONYD_BIN" - rc_status -v - ;; - try-restart|condrestart) - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - rc_status - ;; - restart) - $0 stop - $0 start - rc_status - ;; - force-reload) - echo -n "Reload service $SERVICE " - $0 try-restart - rc_status - ;; - reload) - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for service $SERVICE " - /sbin/checkproc "$CHRONYD_BIN" - rc_status -v - ;; - probe) - test /etc/chronyd.conf -nt /var/run/chronyd.pid && echo reload - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" - exit 1 - ;; -esac -rc_exit diff --git a/chrony.spec b/chrony.spec index 324e895..18a2ec0 100644 --- a/chrony.spec +++ b/chrony.spec @@ -18,17 +18,6 @@ %define vendorzone opensuse. %global clknetsim_ver 71dbbc5 -%if 0%{?suse_version} > 1230 -%bcond_without systemd -%bcond_without syscallfilter -%else -%bcond_with systemd -%bcond_with syscallfilter -%endif -# If is_opensuse is not defined, then this is an older version of SLES -# or some other distribution. So, if not defined then define it as 0 -%if 0%{!?is_opensuse:%global is_opensuse 0} -%endif Name: chrony Version: 3.2 Release: 0 @@ -37,7 +26,6 @@ License: GPL-2.0 Group: Productivity/Networking/Other Url: http://chrony.tuxfamily.org/ Source: http://download.tuxfamily.org/chrony/chrony-%{version}.tar.gz -Source1: chrony.init Source2: chrony.sysconfig Source3: chrony.dhclient Source4: chrony.helper @@ -51,7 +39,6 @@ Patch0: chrony-config.patch Patch1: chrony-service-helper.patch Patch2: chrony-logrotate.patch Patch5: chrony-fix-open.patch -# BuildRequires: NetworkManager-devel BuildRequires: bison BuildRequires: gcc-c++ @@ -62,25 +49,17 @@ BuildRequires: pkgconfig # The timezone package is needed for the "make check" tests. It can be # removed if the call to make check is ever deleted. BuildRequires: timezone +BuildRequires: pkgconfig(systemd) Requires: logrotate Requires(pre): %fillup_prereq Requires(pre): %{_sbindir}/groupadd Requires(pre): %{_sbindir}/useradd Provides: ntp-daemon -BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if %{with syscallfilter} %ifarch s390 s390x ppc64le BuildRequires: libseccomp-devel >= 2.2.0 %else BuildRequires: libseccomp-devel %endif -%endif -%if %{with systemd} -BuildRequires: pkgconfig(systemd) -%{?systemd_requires} -%else -Requires(pre): %insserv_prereq -%endif %description Chrony is an implementation of the Network Time Protocol (NTP). It can @@ -141,90 +120,67 @@ export LDFLAGS="-pie -Wl,-z,relro,-z,now" --with-user=chrony \ --with-hwclockfile=%{_sysconfdir}/adjtime \ --with-sendmail=%{_sbindir}/sendmail - make %{?_smp_mflags} all docs %install -make %{?_smp_mflags} DESTDIR=%{buildroot} install +%make_install +install -Dpm 0644 chrony.conf \ + %{buildroot}%{_sysconfdir}/chrony.conf +install -Dpm 0640 examples/chrony.keys.example \ + %{buildroot}%{_sysconfdir}/chrony.keys +install -Dpm 0755 examples/chrony.nm-dispatcher \ + %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony +install -Dpm 0755 %{SOURCE3} \ + %{buildroot}%{_sysconfdir}/dhcp/dhclient.d/chrony.sh +install -Dpm 0644 examples/chrony.logrotate \ + %{buildroot}%{_sysconfdir}/logrotate.d/chrony +install -Dpm 0644 examples/chronyd.service \ + %{buildroot}%{_unitdir}/chronyd.service +install -Dpm 0644 examples/chrony-wait.service \ + %{buildroot}%{_unitdir}/chrony-wait.service +install -Dpm 0644 %{SOURCE5} \ + %{buildroot}%{_unitdir}/chrony-dnssrv@.service +install -Dpm 0644 %{SOURCE6} \ + %{buildroot}%{_unitdir}/chrony-dnssrv@.timer -mkdir -p %{buildroot}%{_sysconfdir}/{sysconfig,logrotate.d} -mkdir -p %{buildroot}%{_localstatedir}/{lib,log}/chrony -mkdir -p %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d -mkdir -p %{buildroot}%{_sysconfdir}/dhcp/dhclient.d -mkdir -p %{buildroot}%{_datadir} -mkdir -p %{buildroot}{%{_unitdir},%{_prefix}/lib/systemd/ntp-units.d} - -install -m 644 -p chrony.conf %{buildroot}%{_sysconfdir}/chrony.conf - -install -m 640 -p examples/chrony.keys.example \ - %{buildroot}%{_sysconfdir}/chrony.keys -install -m 755 -p examples/chrony.nm-dispatcher \ - %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony -install -m 755 -p %{SOURCE3} \ - %{buildroot}%{_sysconfdir}/dhcp/dhclient.d/chrony.sh -install -m 644 -p examples/chrony.logrotate \ - %{buildroot}%{_sysconfdir}/logrotate.d/chrony - -%if %{with systemd} -install -m 644 -p examples/chronyd.service \ - %{buildroot}%{_unitdir}/chronyd.service -install -m 644 -p examples/chrony-wait.service \ - %{buildroot}%{_unitdir}/chrony-wait.service -install -m 644 -p %{SOURCE5} %{buildroot}%{_unitdir}/chrony-dnssrv@.service -install -m 644 -p %{SOURCE6} %{buildroot}%{_unitdir}/chrony-dnssrv@.timer -ln -s %{_sbindir}/service "%{buildroot}%{_sbindir}/rcchronyd" -ln -s %{_sbindir}/service "%{buildroot}%{_sbindir}/rcchrony-wait" +install -d %{buildroot}%{sbindir} +ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcchronyd +ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcchrony-wait +install -d %{buildroot}%{_prefix}/lib/systemd/ntp-units.d echo 'chronyd.service' > \ %{buildroot}%{_prefix}/lib/systemd/ntp-units.d/50-chronyd.list -%else -install -D -m0755 "%{SOURCE1}" "%{buildroot}%{_initddir}/chronyd" -ln -s ../..%{_initddir}/chronyd "%{buildroot}%{_sbindir}/rcchronyd" -%endif -install -D -m0644 "%{SOURCE2}" "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.chronyd" -install -m 755 -p %{SOURCE4} %{buildroot}%{_datadir}/chrony-helper +install -Dpm 0644 %{SOURCE2} \ + %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.chronyd +install -Dpm 755 %{SOURCE4} \ + %{buildroot}%{_datadir}/chrony-helper +install -d %{buildroot}%{_localstatedir}/log/chrony touch %{buildroot}%{_localstatedir}/lib/chrony/{drift,rtc} %check # Set random seed to get deterministic results export CLKNETSIM_RANDOM_SEED=24501 make %{?_smp_mflags} -C test/simulation/clknetsim - -make check +make %{?_smp_mflags} check %pre -%{_sbindir}/groupadd -r chrony >/dev/null 2>&1 || : -%{_sbindir}/useradd -g chrony -s /bin/false -r -c "Chrony Daemon" -d "%{_localstatedir}/lib/chrony" chrony >/dev/null 2>&1 || : -# START BIG SYSTEMD -%if %{with systemd} +getent group %{name} >/dev/null || groupadd -r %{name} +getent passwd %{name} >/dev/null || useradd -r -g %{name} -d "%{_localstatedir}/lib/chrony" -s /bin/false -c "Chrony Daemon" %{name} %service_add_pre chronyd.service chrony-wait.service -%endif %preun -%if %{with systemd} %service_del_preun chronyd.service chrony-wait.service -%else -%stop_on_removal chronyd -%endif %post %fillup_only %{name} -%if %{with systemd} %service_add_post chronyd.service chrony-wait.service -%endif %postun -%if %{with systemd} %service_del_postun chronyd.service chrony-wait.service -%else -%restart_on_update chronyd -%insserv_cleanup -%endif %files -%defattr(-,root,root) %doc FAQ NEWS README COPYING %doc examples %config(noreplace) %attr(0640,root,%{name}) %{_sysconfdir}/chrony.conf @@ -240,13 +196,9 @@ make check %{_mandir}/man1/chronyc.1%{ext_man} %{_mandir}/man5/chrony.conf.5%{ext_man} %{_mandir}/man8/chronyd.8%{ext_man} -%if %{with systemd} %{_prefix}/lib/systemd/ntp-units.d/*.list %{_unitdir}/chrony*.service %{_unitdir}/chrony*.timer -%else -%config %{_sysconfdir}/init.d/chronyd -%endif %{_sbindir}/rcchrony* %{_localstatedir}/adm/fillup-templates/sysconfig.chronyd %dir %attr(750,chrony,chrony) %{_localstatedir}/lib/chrony From 92481aa2b77ded7140ca8050ddfae96b6452c50a7a19de9046872ed124a8e309 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 26 Oct 2017 12:34:40 +0000 Subject: [PATCH 3/4] OBS-URL: https://build.opensuse.org/package/show/network:time/chrony?expand=0&rev=35 --- chrony.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrony.spec b/chrony.spec index 18a2ec0..51cd22d 100644 --- a/chrony.spec +++ b/chrony.spec @@ -93,7 +93,7 @@ or a different computer. # If this is an openSUSE build, use our vendor zone # (2.*pool.ntp.org names include IPv6 addresses). If not # an openSUSE build, comment out the pool statement -%if %{is_opensuse} +%if 0%{is_opensuse} sed -e 's|^\(pool \)\(pool.ntp.org\)|\12.%{vendorzone}\2|' \ < examples/chrony.conf.example2 > chrony.conf %else From 03c4ecbefc649c3391f9ce55587a130acbad11e679c4fd04dfa7832e20ccd285 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 26 Oct 2017 21:26:35 +0000 Subject: [PATCH 4/4] OBS-URL: https://build.opensuse.org/package/show/network:time/chrony?expand=0&rev=36 --- chrony.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrony.spec b/chrony.spec index 51cd22d..c64c642 100644 --- a/chrony.spec +++ b/chrony.spec @@ -93,7 +93,7 @@ or a different computer. # If this is an openSUSE build, use our vendor zone # (2.*pool.ntp.org names include IPv6 addresses). If not # an openSUSE build, comment out the pool statement -%if 0%{is_opensuse} +%if 0%{?is_opensuse} sed -e 's|^\(pool \)\(pool.ntp.org\)|\12.%{vendorzone}\2|' \ < examples/chrony.conf.example2 > chrony.conf %else