Accepting request 215091 from Base:System

Leave /usr/sbin/rccron in as link to /sbin/service (forwarded request 214974 from aeneas_jaissle)

OBS-URL: https://build.opensuse.org/request/show/215091
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cronie?expand=0&rev=51
This commit is contained in:
Tomáš Chvátal 2014-01-27 10:43:16 +00:00 committed by Git OBS Bridge
commit 565a1a374c
3 changed files with 14 additions and 187 deletions

161
cron.init
View File

@ -1,161 +0,0 @@
#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
#
# Author: Werner Fink <werner@suse.de>, 1996-2001
#
# /etc/init.d/cron
#
# and symbolic its link
#
# /usr/sbin/rccron
#
# System startup script for the cron daemon
#
### BEGIN INIT INFO
# Provides: cron
# Required-Start: $remote_fs $syslog $time
# Should-Start: $network smtp
# Required-Stop: $remote_fs $syslog
# Should-Stop: $network smtp
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Cron job service
# Description: Cron job service
### END INIT INFO
CRON_BIN=/usr/sbin/cron
test -x $CRON_BIN || exit 5
PIDFILE=/var/run/cron.pid
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
allow_deny_move_info() {
echo "WARNING: /var/spool/cron/allow and /var/spool/cron/deny have moved"
echo "to /etc/cron.allow and /etc/cron.deny."
echo "Please merge or move these files to get cron access rules restored."
}
case "$1" in
start)
for al_de in {allow,deny}{,.rpmsave,.rpmorig} ; do
if [ -f /var/spool/cron/$al_de ] ; then
allow_deny_move_info
break
fi
done
echo -n "Starting CRON daemon"
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
# NOTE: startproc return 0, even if service is
# already running to match LSB spec.
startproc -p $PIDFILE $CRON_BIN
#startproc -f $CRON_BIN
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down CRON daemon"
## Stop daemon with killproc(8) and if this fails
## set echo the echo return value.
killproc -TERM -p $PIDFILE $CRON_BIN
# Remember status and be verbose
rc_status -v
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
$0 status >/dev/null && $0 restart
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
force-reload)
## Signal the daemon to reload its config. Most daemons
## do this on signal 1 (SIGHUP).
## If it does not support it, restart.
echo -n "Reload service Cron"
## if it supports it:
## cron monitors /etc/crontab anyway
checkproc $CRON_BIN
rc_status -v
## Otherwise:
#$0 stop && $0 start
#rc_status
;;
reload)
## Like force-reload, but if daemon does not support
## signalling, do nothing (!)
## Otherwise if it does not support reload:
rc_status -v
;;
status)
echo -n "Checking for Cron: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc $CRON_BIN
rc_status -v
;;
probe)
## Optional: Probe for the necessity of a reload,
## give out the argument which is required for a reload.
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Jan 23 21:08:55 UTC 2014 - aj@ajaissle.de
- Leave /usr/sbin/rccron in as link to /sbin/service
-------------------------------------------------------------------
Sun Oct 20 14:50:52 UTC 2013 - p.drouand@gmail.com
- Remove old sysvinit hacks; none target distributions use sysvinit
-------------------------------------------------------------------
Wed Sep 25 16:02:13 UTC 2013 - vdziewiecki@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package cronie
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,7 +17,7 @@
# 3 : we don't need to do something with /etc/sysconfig/cron for now
%define cron_configs \{/etc/init.d/cron,/etc/pam.d/crond,/etc/crontab,/etc/cron.deny,/etc/omc/srvinfo.d/cron.xml\}
%define cron_configs \{/etc/pam.d/crond,/etc/crontab,/etc/cron.deny,/etc/omc/srvinfo.d/cron.xml\}
Name: cronie
BuildRequires: audit-devel
@ -27,7 +27,7 @@ BuildRequires: pkgconfig(systemd)
Url: https://fedorahosted.org/cronie/
Recommends: smtp_daemon
Suggests: postfix
PreReq: permissions %fillup_prereq %insserv_prereq cron
PreReq: permissions cron
%{?systemd_requires}
Version: 1.4.11
Release: 0
@ -36,7 +36,6 @@ Summary: Cron Daemon
License: BSD-3-Clause and GPL-2.0 and MIT
Group: System/Daemons
Source0: https://fedorahosted.org/releases/c/r/%name/%name-%version.tar.gz
Source1: cron.init
Source2: run-crons
Source3: sample.root
Source4: deny.sample
@ -118,9 +117,7 @@ export LDFLAGS="-Wl,-z,relro,-z,now,-z,defs"
%{__install} -v -m 600 %{SOURCE4} %{buildroot}/etc/cron.deny
%{__install} -v -d %{buildroot}/usr/lib/cron
%{__install} -v %{SOURCE2} %{buildroot}/usr/lib/cron
%{__install} -v -d %{buildroot}%{_sysconfdir}/init.d/
%{__install} -v -m744 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/cron
%{__ln_s} -f ../../etc/init.d/cron %{buildroot}/usr/sbin/rccron
%{__ln_s} -f ../../sbin/service %{buildroot}/usr/sbin/rccron
%{__install} -v -d %{buildroot}/%{_unitdir}
%{__install} -v -m 644 %{SOURCE8} %{buildroot}/%{_unitdir}
%{__install} -m 644 contrib/anacrontab $RPM_BUILD_ROOT%{_sysconfdir}/anacrontab
@ -162,39 +159,21 @@ fi
%post
# when we are doing rename then we pretend update with set 2
if [ -e /var/run/update_from_old_cron ]; then
set 2
%restart_on_update cron
# in %%postun restart_on_update call try-restart but we don't have init script in this phase when
# we are doing "ugly" update, but don't panic, it produces only warning to stderr
echo "Please ignore message about missing init script(from postun) - when occurs, we will install init script later with cronie package"
%__mv /etc/init.d/cron /etc/init.d/cron.bk ||:
%__ln_s /bin/true /etc/init.d/cron
fi
%{fillup_and_insserv -y cron}
%if 0%{?suse_version} >= 1140
%set_permissions /etc/crontab /usr/bin/crontab
%else
%run_permissions
%endif
%service_add_post cron.service
%verifyscript
%verify_permissions -e /etc/crontab -e /usr/bin/crontab
%preun
%stop_on_removal cron
%service_del_preun cron.service
%postun
%restart_on_update cron
%insserv_cleanup
%service_del_postun cron.service
%posttrans
if [ -e /var/run/update_from_old_cron ]; then
%{__rm} /var/run/update_from_old_cron ||:
%__mv /etc/init.d/cron.bk /etc/init.d/cron ||:
fi
%post anacron
@ -208,7 +187,6 @@ fi
%dir %attr(700,root,root) /var/spool/cron
%dir %attr(700,root,root) /var/spool/cron/tabs
%dir /var/spool/cron/lastrun
%config /etc/init.d/cron
%config /etc/pam.d/crond
%verify(not mode) %config(noreplace) /etc/crontab
%config(noreplace) /etc/cron.deny