- 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
This commit is contained in:
Martin Pluskal 2017-10-26 11:15:56 +00:00 committed by Git OBS Bridge
parent f16919c0b4
commit 9a79f15b95
3 changed files with 39 additions and 194 deletions

View File

@ -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

View File

@ -1,114 +0,0 @@
#!/bin/sh
#
# openSUSE system startup script for chronyd
# Copyright (C) 2010 Pascal Bleser <pascal.bleser@opensuse.org>
#
# 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

View File

@ -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