From b8ac3768b4b918d4700e560872a90e297268ffdb7eccf6a62add45610ec34025 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Mon, 9 Nov 2020 07:45:47 +0000 Subject: [PATCH] - No need to run 'systemd-sysv-convert --save' in %service_add_pre anymore Due to the fact that the initscripts being removed during package updates are still available in %post, systemd-sysv-convert has been reworked so it's only needed to call it in %post. OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=44 --- macros.systemd | 49 +++++++------------------------------- systemd-rpm-macros.changes | 9 +++++++ 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/macros.systemd b/macros.systemd index ebe7201..dd5cadb 100644 --- a/macros.systemd +++ b/macros.systemd @@ -69,14 +69,7 @@ OrderWithRequires(postun): systemd \ %{nil} %service_add_pre() \ -# disable migration if initial install under systemd \ -[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \ -if [ $1 -eq 1 ]; then \ - for service in %{?*} ; do \ - sysv_service="${service%%.*}" \ - touch "/var/lib/systemd/migrated/$sysv_service" || : \ - done \ -else \ +if [ $1 -gt 1 -a -x /usr/bin/systemctl ]; then \ for service in %{?*} ; do \ # The tag file might have been left by a preceding \ # update (see bsc#1059627) \ @@ -86,32 +79,20 @@ else \ touch "/run/rpm-%{name}-update-$service-new-in-upgrade" \ fi \ done \ - for service in %{?*} ; do \ - sysv_service="${service%%.*}" \ - if [ -e /var/lib/systemd/migrated/$sysv_service ]; then \ - continue \ - fi \ - if [ ! -x /usr/lib/systemd/systemd-sysv-convert ]; then \ - continue \ - fi \ - /usr/lib/systemd/systemd-sysv-convert --save $sysv_service || : \ - done \ fi \ %{nil} # On install, tell systemd to reload its unit files %service_add_post() \ -[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \ - \ if [ -x /usr/bin/systemctl ]; then \ /usr/bin/systemctl daemon-reload || : \ fi \ \ -if [ $1 -eq 1 ]; then \ +if [ $1 -eq 1 ]; then \ if [ -x /usr/bin/systemctl ]; then \ /usr/bin/systemctl preset %{?*} || : \ fi \ -elif [ $1 -gt 1 ]; then \ +elif [ $1 -gt 1 ]; then \ for service in %{?*} ; do \ if [ ! -e "/run/rpm-%{name}-update-$service-new-in-upgrade" ]; then \ continue \ @@ -122,23 +103,16 @@ elif [ $1 -gt 1 ]; then \ fi \ /usr/bin/systemctl preset "$service" || : \ done \ - for service in %{?*} ; do \ - sysv_service=${service%%.*} \ - if [ -e /var/lib/systemd/migrated/$sysv_service ]; then \ - continue \ - fi \ - if [ ! -x /usr/lib/systemd/systemd-sysv-convert ]; then \ - continue \ - fi \ - /usr/lib/systemd/systemd-sysv-convert --apply $sysv_service || : \ - touch /var/lib/systemd/migrated/$sysv_service || : \ - done \ + \ + if [ -x /usr/lib/systemd/systemd-sysv-convert ]; then \ + /usr/lib/systemd/systemd-sysv-convert --apply %{?*} || : \ + fi \ fi \ %{nil} # On uninstall, disable and stop services # -# Note: '-n' and '-f' options are still allowed to kept backward compatibility +# Note: '-n' and '-f' options are still allowed to keep backward compatibility # with SLE # %service_del_preun(fn) \ @@ -152,13 +126,6 @@ fi \ # On update, tell systemd to reload its unit files but don't restart service. # %service_del_postun_without_restart() \ -if [ $1 -eq 0 ]; then \ - # Package removal \ - for service in %{?*} ; do \ - sysv_service="${service%.*}" \ - rm -f "/var/lib/systemd/migrated/$sysv_service" || : \ - done \ -fi \ if [ -x /usr/bin/systemctl ]; then \ /usr/bin/systemctl daemon-reload || : \ fi \ diff --git a/systemd-rpm-macros.changes b/systemd-rpm-macros.changes index f683614..05e5cba 100644 --- a/systemd-rpm-macros.changes +++ b/systemd-rpm-macros.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Nov 9 07:44:40 UTC 2020 - Franck Bui + +- No need to run 'systemd-sysv-convert --save' in %service_add_pre anymore + + Due to the fact that the initscripts being removed during package + updates are still available in %post, systemd-sysv-convert has been + reworked so it's only needed to call it in %post. + ------------------------------------------------------------------- Mon Nov 9 07:35:12 UTC 2020 - Franck Bui