From e5d6d1a3e536865535589b4262264a07f147f26f238a6c43d84a368c17cb0bdb Mon Sep 17 00:00:00 2001 From: Thomas Blume Date: Mon, 25 Feb 2019 09:47:37 +0000 Subject: [PATCH] Accepting request 678270 from home:fbui:branches:Base:System - Introduce %service_del_postun_without_restart This is another step to make the SUSE rpm macros closer to their upstream counterparts. Introduce %service_del_postun_without_restart which should help in getting rid of '-f' and '-n' switches of %service_del_postun. OBS-URL: https://build.opensuse.org/request/show/678270 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=32 --- macros.systemd | 47 ++++++++++++++++++++++++-------------- systemd-rpm-macros.changes | 11 +++++++++ 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/macros.systemd b/macros.systemd index 451c26d..9e32daa 100644 --- a/macros.systemd +++ b/macros.systemd @@ -18,6 +18,7 @@ # # %postun # %service_del_postun demo.service +# %service_del_postun_without_restart demo.service # %_unitdir /usr/lib/systemd/system @@ -157,34 +158,46 @@ if [ "$FIRST_ARG" -eq 0 -a -x /usr/bin/systemctl ]; then \ fi \ %{nil} -# On uninstall, tell systemd to reload its unit files +# On uninstall, tell systemd to reload its unit files. +# On update, tell systemd to reload its unit files but don't restart service. # -# Options used if not in an installation systems -# -f that is fore service restart in removal -# -n that do not touch active service -# the default is to check for DISABLE_RESTART_ON_UPDATE environment -# variable if not found use the value read from /etc/sysconfig/services -# - -%service_del_postun(fn) \ +%service_del_postun_without_restart() \ test -n "$FIRST_ARG" || FIRST_ARG="$1" \ -if [ "$FIRST_ARG" -ge 1 ]; then \ - # Package upgrade, not uninstall \ - if [ -x /usr/bin/systemctl ]; then \ - /usr/bin/systemctl daemon-reload || : \ - %{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \ - fi \ -else # package uninstall \ +if [ "$FIRST_ARG" -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 \ +%{nil} + +# On uninstall, tell systemd to reload its unit files +# +# Options used if not in an installation systems +# -f that is force service restart in removal (deprecated) +# -n that do not touch active service (depredacted) +# the default is to check for DISABLE_RESTART_ON_UPDATE environment +# variable if not found use the value read from /etc/sysconfig/services +# +%service_del_postun(fn) \ +test -n "$FIRST_ARG" || FIRST_ARG="$1" \ +%service_del_postun_without_restart %{?*} \ +if [ "$FIRST_ARG" -ge 1 ]; then \ + # Package upgrade, not uninstall \ if [ -x /usr/bin/systemctl ]; then \ - /usr/bin/systemctl daemon-reload || : \ + %{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \ fi \ fi \ %{nil} +# +# Upstream variants +# + %systemd_post() \ if [ $1 -eq 1 -a -x /usr/bin/systemctl ] ; then \ # Initial installation \ diff --git a/systemd-rpm-macros.changes b/systemd-rpm-macros.changes index a9e9d93..a9ed8e6 100644 --- a/systemd-rpm-macros.changes +++ b/systemd-rpm-macros.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Thu Feb 22 13:00:18 UTC 2019 - Franck Bui + +- Introduce %service_del_postun_without_restart + + This is another step to make the SUSE rpm macros closer to their + upstream counterparts. + + Introduce %service_del_postun_without_restart which should help in + getting rid of '-f' and '-n' switches of %service_del_postun. + ------------------------------------------------------------------- Thu Feb 21 17:53:18 UTC 2019 - Franck Bui