From cc22649b875b1325482c502ae25dd3cf8a0def6da86bd1890dfe5d4e0e75c1b9 Mon Sep 17 00:00:00 2001 From: Danilo Spinella Date: Tue, 13 Dec 2022 09:23:40 +0000 Subject: [PATCH] Accepting request 1041108 from home:schubi2:pam_usr_etc - Migration PAM settings to /usr/etc: Saving user changed configuration files in /etc and restoring them while an RPM update. - Removed update support from 4.1 vixie-cron which is really old. OBS-URL: https://build.opensuse.org/request/show/1041108 OBS-URL: https://build.opensuse.org/package/show/Base:System/cronie?expand=0&rev=207 --- cronie.changes | 8 ++++++++ cronie.spec | 40 ++++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/cronie.changes b/cronie.changes index 657f526..aa6b78e 100644 --- a/cronie.changes +++ b/cronie.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Dec 7 10:11:32 UTC 2022 - Stefan Schubert + +- Migration PAM settings to /usr/etc: Saving user changed + configuration files in /etc and restoring them while an RPM + update. +- Removed update support from 4.1 vixie-cron which is really old. + ------------------------------------------------------------------- Wed May 11 09:17:27 UTC 2022 - Danilo Spinella diff --git a/cronie.spec b/cronie.spec index a11f198..623256c 100644 --- a/cronie.spec +++ b/cronie.spec @@ -148,34 +148,34 @@ touch %{buildroot}%{_localstatedir}/spool/anacron/cron.daily touch %{buildroot}%{_localstatedir}/spool/anacron/cron.weekly touch %{buildroot}%{_localstatedir}/spool/anacron/cron.monthly -%pre -n cron -# 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 - touch %{_localstatedir}/run/update_from_old_cron - for conf in %{cron_configs} ; do - cp "$conf" "$conf.rpmbk" - done -fi -exit 0 +%if 0%{?suse_version} > 1500 +mkdir -p %{buildroot}%{_distconfdir}/pam.d +mv %{buildroot}%{_sysconfdir}/pam.d/crond %{buildroot}%{_distconfdir}/pam.d/ +%endif %pre +%if 0%{?suse_version} > 1500 +# Prepare for migration to /usr/etc; save any old .rpmsave +for i in pam.d/crond ; do + test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||: +done +%endif %service_add_pre cron.service %post -# 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 +%if 0%{?suse_version} > 1500 +%posttrans +# Migration to /usr/etc, restore just created .rpmsave +for i in pam.d/crond ; do + test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||: +done +%endif + %verifyscript %verify_permissions -e %{_sysconfdir}/crontab -e %{_bindir}/crontab @@ -210,7 +210,11 @@ exit 0 %dir %attr(700,root,root) %{_localstatedir}/spool/cron %dir %attr(700,root,root) %{_localstatedir}/spool/cron/tabs %dir %{_localstatedir}/spool/cron/lastrun +%if 0%{?suse_version} > 1500 +%{_distconfdir}/pam.d/crond +%else %config %{_sysconfdir}/pam.d/crond +%endif %verify(not mode) %config(noreplace) %{_sysconfdir}/crontab %config(noreplace) %{_sysconfdir}/cron.deny %{_mandir}/man1/crontab.1%{?ext_man}