Accepting request 313104 from home:scarabeus_iv:branches:Base:System

- Redo the post/pre update approach to fix migration from SLE11.
  Should fix bnc#919028

OBS-URL: https://build.opensuse.org/request/show/313104
OBS-URL: https://build.opensuse.org/package/show/Base:System/cronie?expand=0&rev=142
This commit is contained in:
Kristyna Streitova 2015-06-22 14:48:19 +00:00 committed by Git OBS Bridge
parent abff32990a
commit 93a4cef2d6
2 changed files with 20 additions and 25 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Jun 22 14:21:25 UTC 2015 - tchvatal@suse.com
- Redo the post/pre update approach to fix migration from SLE11.
Should fix bnc#919028
-------------------------------------------------------------------
Fri Jun 19 14:51:05 UTC 2015 - kstreitova@suse.com

View File

@ -16,7 +16,6 @@
#
# 3 : we don't need to do something with /etc/sysconfig/cron for now
%define cron_configs %{_sysconfdir}/pam.d/crond %{_sysconfdir}/crontab %{_sysconfdir}/cron.deny %{_sysconfdir}/omc/srvinfo.d/cron.xml
Name: cronie
Version: 1.5.0
@ -61,9 +60,6 @@ Requires(pre): cron
Recommends: smtp_daemon
Suggests: postfix
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
%{?systemd_requires}
%{expand: %%define cronie_version %{version}}
@ -150,34 +146,32 @@ install -v -d %{buildroot}%{_sysconfdir}/omc/srvinfo.d/
install -v -m644 %{SOURCE5} %{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=`%{_sbindir}/cron --help 2>&1 | %{_bindir}/grep mail`
# vixie-cron 4.1 doesn't contain mail fature
# Check if we are doing update from 4.1 vixie-cron.
# The -h does report garbage on vixie cron.
check_cron_mail_feature=`%{_sbindir}/cron -h 2>&1 | %{_bindir}/grep mail`
if [ -e %{_sbindir}/cron -a -z "${check_cron_mail_feature}" ]; then
# save configs for cronie post-install phase
touch %{_localstatedir}/run/update_from_old_cron
echo $1
for conf in %{cron_configs}
do
mv "$conf" "$conf.bk" ||:
for conf in %{cron_configs} ; do
cp "$conf" "$conf.rpmbk"
done
fi
exit 0
%pre
if [ -e %{_localstatedir}/run/update_from_old_cron ]; then
# restore configs
for conf in %{cron_configs}
do
mv "$conf.bk" "$conf" ||:
done
fi
%service_add_pre cron.service
%post
# when we are doing rename then we pretend update with set 2
# Move the old cron configurations back if we were updating
if [ -e %{_localstatedir}/run/update_from_old_cron ]; then
for conf in %{cron_configs} ; do
mv "$conf.rpmbk" "$conf"
done
rm %{_localstatedir}/run/update_from_old_cron
fi
%set_permissions %{_sysconfdir}/crontab %{_bindir}/crontab
%{fillup_only -n cron}
%service_add_post cron.service
exit 0
%verifyscript
%verify_permissions -e %{_sysconfdir}/crontab -e %{_bindir}/crontab
@ -188,11 +182,6 @@ fi
%postun
%service_del_postun cron.service
%posttrans
if [ -e %{_localstatedir}/run/update_from_old_cron ]; then
rm %{_localstatedir}/run/update_from_old_cron ||:
fi
%post anacron
[ -e %{_localstatedir}/spool/anacron/cron.daily ] || touch %{_localstatedir}/spool/anacron/cron.daily
[ -e %{_localstatedir}/spool/anacron/cron.weekly ] || touch %{_localstatedir}/spool/anacron/cron.weekly