Browse Source

new: cronie-1.4.11-1

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@8610 ec354946-7b23-47d6-9f5a-488ba84defc7
iwaim 9 years ago
parent
commit
7066f53d5f
2 changed files with 165 additions and 47 deletions
  1. 33 47
      c/cronie/cronie-vl.spec
  2. 132 0
      c/cronie/cronie.init

+ 33 - 47
c/cronie/cronie.spec → c/cronie/cronie-vl.spec

@@ -1,23 +1,33 @@
-%bcond_without selinux
+%bcond_with selinux
 %bcond_without pam
 %bcond_without audit
 %bcond_without inotify
 
+%define ver 1.4.11
+%define rel 1
+
 Summary:   Cron daemon for executing programs at set times
 Name:      cronie
-Version:   1.4.11
-Release:   11%{?dist}
+Version:   %{ver}
+Release:   %{rel}%{?_dist_release}
 License:   MIT and BSD and ISC and GPLv2+
 Group:     System Environment/Base
 URL:       https://fedorahosted.org/cronie
 Source0:   https://fedorahosted.org/releases/c/r/cronie/%{name}-%{version}.tar.gz
-Patch0:    cronie-systemd.patch
+# from cronie 1.4.8 tarball
+Source1:   cronie.init
+#Patch0:    cronie-systemd.patch
 Patch1:    cronie-1.4.11-fcntl_locking.patch
 Patch2:    cronie-1.4.11-pamenv.patch
 Patch3:    cronie-1.4.11-man-debug.patch
 Patch4:    cronie-check-config-param.patch
 
 Requires:  dailyjobs
+Conflicts: vixie-cron
+
+Vendor: Project Vine
+Distribution: Vine Linux
+Packager: iwaim
 
 %if %{with selinux}
 Requires:      libselinux >= 2.0.64
@@ -31,14 +41,9 @@ Buildrequires: pam-devel >= 1.0.1
 Buildrequires: audit-libs-devel >= 1.4.1
 %endif
 
-BuildRequires:    systemd
-Obsoletes:        %{name}-sysvinit
-
-Requires(post):   coreutils sed
-Requires(post):   systemd
-Requires(preun):  systemd
-Requires(postun): systemd
-Requires(post):   systemd
+Requires(post): coreutils sed
+Requires(post): chkconfig
+Requires(preun): chkconfig
 
 %description
 Cronie contains the standard UNIX daemon crond that runs specified programs at
@@ -80,7 +85,7 @@ extra features.
 
 %prep
 %setup -q
-%patch0 -p1
+#%patch0 -p1
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
@@ -128,13 +133,13 @@ touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly
 # noanacron package
 install -m 644 contrib/dailyjobs $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/dailyjobs
 
-# install systemd initscript
-mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/
-install -m 644 contrib/cronie.systemd $RPM_BUILD_ROOT/usr/lib/systemd/system/crond.service
+# install initscript
+mkdir -p $RPM_BUILD_ROOT%{_initddir}
+install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/crond
 
 %post
 # run after an installation
-%systemd_post crond.service
+/sbin/chkconfig --add crond
 
 %post anacron
 [ -e /var/spool/anacron/cron.daily ] || touch /var/spool/anacron/cron.daily
@@ -143,38 +148,16 @@ install -m 644 contrib/cronie.systemd $RPM_BUILD_ROOT/usr/lib/systemd/system/cro
 
 %preun
 # run before a package is removed
-%systemd_preun crond.service
+if [ "$1" -eq 0 ]; then
+        /sbin/service crond stop >/dev/null 2>&1
+        /sbin/chkconfig --del crond
+fi
 
 %postun
 # run after a package is removed
-%systemd_postun_with_restart crond.service
-
-%triggerun -- cronie-anacron < 1.4.1
-# empty /etc/crontab in case there are only old regular jobs
-cp -a /etc/crontab /etc/crontab.rpmsave
-sed -e '/^01 \* \* \* \* root run-parts \/etc\/cron\.hourly/d'\
-  -e '/^02 4 \* \* \* root run-parts \/etc\/cron\.daily/d'\
-  -e '/^22 4 \* \* 0 root run-parts \/etc\/cron\.weekly/d'\
-  -e '/^42 4 1 \* \* root run-parts \/etc\/cron\.monthly/d' /etc/crontab.rpmsave > /etc/crontab
-exit 0
-
-%triggerun -- cronie < 1.4.7-2
-# Save the current service runlevel info
-# User must manually run systemd-sysv-convert --apply crond
-# to migrate them to systemd targets
-/usr/bin/systemd-sysv-convert --save crond
-
-# The package is allowed to autostart:
-/bin/systemctl enable crond.service >/dev/null 2>&1
-
-/sbin/chkconfig --del crond >/dev/null 2>&1 || :
-/bin/systemctl try-restart crond.service >/dev/null 2>&1 || :
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-
-%triggerin -- pam, glibc, libselinux
-# changes in pam, glibc or libselinux can make crond crash
-# when it calls pam
-/bin/systemctl try-restart crond.service >/dev/null 2>&1 || :
+if [ "$1" -ge "1" ]; then
+  /sbin/service crond condrestart >/dev/null 2>&1 || :
+fi
 
 %files
 %doc AUTHORS COPYING INSTALL README ChangeLog
@@ -192,7 +175,7 @@ exit 0
 %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/crond
 %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/cron.deny
 %attr(0644,root,root) %{_sysconfdir}/cron.d/0hourly
-%attr(0644,root,root) /usr/lib/systemd/system/crond.service
+%attr(0755,root,root) %{_initddir}/crond
 
 %files anacron
 %{_sbindir}/anacron
@@ -209,6 +192,9 @@ exit 0
 %attr(0644,root,root) %{_sysconfdir}/cron.d/dailyjobs
 
 %changelog
+* Thu Jun 26 2014 IWAI, Masaharu <iwaim.sub@gmail.com> 1.4.11-1
+- initial build for Vine Linux
+
 * Mon Jan 27 2014 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.11-11
 - now it's work even on ppc64, all checks working correctly
 - Related: rhbz#1031384

+ 132 - 0
c/cronie/cronie.init

@@ -0,0 +1,132 @@
+#!/bin/sh
+#
+# crond          Start/Stop the cron clock daemon.
+#
+# chkconfig: 2345 90 60
+# description: cron is a standard UNIX program that runs user-specified \
+#              programs at periodic scheduled times. vixie cron adds a \
+#              number of features to the basic UNIX cron, including better \
+#              security and more powerful configuration options.
+
+### BEGIN INIT INFO
+# Provides: crond crontab
+# Required-Start: $local_fs $syslog
+# Required-Stop: $local_fs $syslog
+# Default-Start:  2345
+# Default-Stop: 90
+# Short-Description: run cron daemon
+# Description: cron is a standard UNIX program that runs user-specified 
+#              programs at periodic scheduled times. vixie cron adds a 
+#              number of features to the basic UNIX cron, including better 
+#              security and more powerful configuration options.
+### END INIT INFO
+
+[ -f /etc/sysconfig/crond ] || { 
+    [ "$1" = "status" ] && exit 4 || exit 6 
+}
+
+RETVAL=0
+prog="crond"
+exec=/usr/sbin/crond
+lockfile=/var/lock/subsys/crond
+config=/etc/sysconfig/crond
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+start() {
+    if [ $UID -ne 0 ] ; then
+        echo "User has insufficient privilege."
+        exit 4
+    fi
+    [ -x $exec ] || exit 5
+    [ -f $config ] || exit 6
+    echo -n $"Starting $prog: "
+    daemon $prog $CRONDARGS
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+}
+
+stop() {
+    if [ $UID -ne 0 ] ; then
+        echo "User has insufficient privilege."
+        exit 4
+    fi
+    echo -n $"Stopping $prog: "
+	if [ -n "`pidfileofproc $exec`" ]; then
+		killproc $exec
+		RETVAL=3
+	else
+		failure $"Stopping $prog"
+	fi
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+	echo -n $"Reloading $prog: "
+	if [ -n "`pidfileofproc $exec`" ]; then
+		killproc $exec -HUP
+	else
+		failure $"Reloading $prog"
+	fi
+	retval=$?
+	echo
+}
+
+force_reload() {
+	# new configuration takes effect after restart
+    restart
+}
+
+rh_status() {
+    # run checks to determine if the service is running or use generic status
+    status -p /var/run/crond.pid $prog
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        rh_status_q || exit 7
+        $1
+        ;;
+    force-reload)
+        force_reload
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+        exit 2
+esac
+exit $?
+