diff --git a/cron_to_cronie.README b/cron_to_cronie.README new file mode 100644 index 0000000..22261b1 --- /dev/null +++ b/cron_to_cronie.README @@ -0,0 +1,5 @@ +package cron 4.2 is only auxiliary package needed for proper renaming package cron to cronie + +usefull links : +http://en.opensuse.org/Cron_replace +http://en.opensuse.org/Cron_rename diff --git a/cronie-1.4.5_git201007091204.tar.bz2 b/cronie-1.4.5_git201007091204.tar.bz2 deleted file mode 100644 index d3b9274..0000000 --- a/cronie-1.4.5_git201007091204.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:720811c8d4a2c6fa7a27c06e151922a65240323e377ff6507c09bb00c8a7b1c5 -size 83033 diff --git a/cronie-1.4.5_git201010210619.tar.xz b/cronie-1.4.5_git201010210619.tar.xz new file mode 100644 index 0000000..0554b96 --- /dev/null +++ b/cronie-1.4.5_git201010210619.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e76bd653725d3df743d9e32da4f548f9d8ed4b84cba73848cc6acf88f0e24f5 +size 84656 diff --git a/cronie-nheader_lines.diff b/cronie-nheader_lines.diff index 583c5cc..b4ebd03 100644 --- a/cronie-nheader_lines.diff +++ b/cronie-nheader_lines.diff @@ -1,17 +1,15 @@ -Index: cronie-1.4.3/src/crontab.c -=================================================================== ---- cronie-1.4.3.orig/src/crontab.c -+++ cronie-1.4.3/src/crontab.c -@@ -33,7 +33,7 @@ +--- src/crontab.c.orig ++++ src/crontab.c +@@ -38,7 +38,7 @@ # include #endif -#define NHEADER_LINES 0 +#define NHEADER_LINES 3 - enum opt_t {opt_unknown, opt_list, opt_delete, opt_edit, opt_replace}; + enum opt_t {opt_unknown, opt_list, opt_delete, opt_edit, opt_replace, opt_hostset, opt_hostget}; -@@ -347,7 +347,7 @@ static char *tmp_path() { +@@ -433,7 +433,7 @@ static char *host_specific_filename(char static void edit_cmd(void) { char n[MAX_FNAME], q[MAX_TEMPSTR], *editor; FILE *f; @@ -20,7 +18,7 @@ Index: cronie-1.4.3/src/crontab.c struct stat statbuf; struct utimbuf utimebuf; WAIT_T waiter; -@@ -399,13 +399,25 @@ static void edit_cmd(void) { +@@ -485,13 +485,25 @@ static void edit_cmd(void) { } Set_LineNum(1) @@ -53,15 +51,15 @@ Index: cronie-1.4.3/src/crontab.c while (EOF != (ch = get_char(f))) putc(ch, NewCrontab); -@@ -605,6 +617,7 @@ static int replace_cmd(void) { +@@ -699,6 +711,7 @@ static int replace_cmd(void) { int error = 0; entry *e; uid_t file_owner; + time_t now = time(NULL); char **envp = env_init(); + char *safename; - if (envp == NULL) { -@@ -636,10 +649,10 @@ static int replace_cmd(void) { +@@ -732,10 +745,10 @@ static int replace_cmd(void) { * * VERY IMPORTANT: make sure NHEADER_LINES agrees with this code. */ diff --git a/cronie.changes b/cronie.changes index 32f2207..428f012 100644 --- a/cronie.changes +++ b/cronie.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Thu Oct 21 19:32:39 UTC 2010 - cristian.rodriguez@opensuse.org + +- Update to cronie 1.4.5_git201010210619 + * Fix broken ifdef HAS_FCHOWN + * Cronie supports "clustering" now. + +------------------------------------------------------------------- +Wed Oct 13 17:42:15 UTC 2010 - mseben@gmail.com + +- added scriptlets and subpackage cron for propper update + ------------------------------------------------------------------- Thu Aug 26 01:34:34 UTC 2010 - cristian.rodriguez@opensuse.org diff --git a/cronie.spec b/cronie.spec index cf9ad7f..282b711 100644 --- a/cronie.spec +++ b/cronie.spec @@ -14,29 +14,36 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - +# # norootforbuild - +# +# beware : +# 1 : noreplace for /etc/cron.deny /etc/crontab +# 2 : /etc/pam.d/crond is different in cron and cronie +# 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\} Name: cronie -BuildRequires: audit-devel libselinux-devel pam-devel +BuildRequires: xz audit-devel libselinux-devel pam-devel Url: https://fedorahosted.org/cronie/ License: MIT and BSD and GPLv2 Group: System/Daemons -Requires: smtp_daemon +Recommends: smtp_daemon Recommends: postfix AutoReqProv: on -PreReq: permissions %fillup_prereq %insserv_prereq -Version: 1.4.5_git201007091204 +PreReq: permissions %fillup_prereq %insserv_prereq cron +Version: 1.4.5_git201010210619 +%{expand: %%define cronie_version %version} Release: 1 Summary: Cron Daemon -Source0: %name-%version.tar.bz2 +Source0: %name-%version.tar.xz Source1: cron.init Source2: run-crons Source3: sample.root Source4: deny.sample Source5: cron.xml Source6: cronie-rpmlintrc +Source7: cron_to_cronie.README # PATCH-FEATURE-OPENSUSE cronie-pam_config.diff added pam config file from old cron Patch3: %name-pam_config.diff # openSUSE set NHEADER_LINES to 3 - old openSUSE cron put three lines of comments @@ -45,9 +52,11 @@ Patch3: %name-pam_config.diff Patch4: %name-nheader_lines.diff # we use cron.pid instead of crond.pid Patch5: %name-crond_pid.diff +Conflicts: cron <= 4.1 +# When finish update protection of sles11 we could uncomment line bellow and drop all +# ugly hacks with subpackage cron needed for proper update proces +# Obsoletes: cron <=4.x BuildRoot: %{_tmppath}/%{name}-%{version}-build -Provides: cron = 4.2 -Obsoletes: cron <= 4.1 %description cron automatically starts programs at specific times. Add new entries @@ -58,6 +67,15 @@ Under /etc, find the directories cron.hourly, cron.daily, cron.weekly, and cron.monthly. Scripts and programs that are located there are started automatically. +%package -n cron +Version: 4.2 +Summary: Auxiliary package +Group: System/Daemons +Requires: %{name} = %{cronie_version}-%{release} + +%description -n cron +Auxiliary package, needed for proper update from vixie-cron 4.1 to cronie 1.4.4 + %package anacron License: MIT and BSD and GPLv2 Summary: Utility for running regular jobs @@ -72,8 +90,9 @@ overloaded in settings. %prep %setup -q %patch3 -p1 -%patch4 -p1 +%patch4 %patch5 -p1 +cp %{S:7} ./cron_to_cronie.README %build autoreconf -fiv @@ -106,8 +125,41 @@ touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly %{__install} -v -d %{buildroot}%{_sysconfdir}/omc/srvinfo.d/ %{__install} -v -m644 %{S:5} %{buildroot}%{_sysconfdir}/omc/srvinfo.d/ +%pre -n cron +# check if we are doing "ugly" update from old 4.1 vixie-cron +check_cron_mail_feature=`/usr/sbin/cron --help 2>&1 | /usr/bin/grep mail` +# vixie-cron 4.1 doesn't contain mail fature +if [ -e /usr/sbin/cron -a "${check_cron_mail_feature}" == "" ]; then + # save configs for cronie post-install phase + touch /var/run/update_from_old_cron + echo $1 + for conf in %{cron_configs} + do + %__mv "$conf" "$conf.bk" ||: + done +fi + +%pre +if [ -e /var/run/update_from_old_cron ]; then + # restore configs + for conf in %{cron_configs} + do + %__mv "$conf.bk" "$conf" ||: + done +fi + %post -%{fillup_and_insserv -y cron} +# 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} %run_permissions %verifyscript %verify_permissions -e /etc/crontab -e /usr/bin/crontab @@ -117,7 +169,13 @@ touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly %postun %restart_on_update cron -%{insserv_cleanup} +%insserv_cleanup + +%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 [ -e /var/spool/anacron/cron.daily ] || touch /var/spool/anacron/cron.daily @@ -158,4 +216,8 @@ touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly %{_mandir}/man5/anacrontab.* %{_mandir}/man8/anacron.* +%files -n cron +%defattr(-,root,root,-) +%doc cron_to_cronie.README + %changelog