diff --git a/macros.systemd b/macros.systemd index e08e745..e7e4001 100644 --- a/macros.systemd +++ b/macros.systemd @@ -66,20 +66,6 @@ OrderWithRequires(postun): systemd \ Suggests: systemd \ %{nil} -%_restart_on_update_force() /usr/bin/systemctl try-restart %{*} || : %{nil} -%_restart_on_update_never() : # Restart of %{*} skipped %{nil} - -%_restart_on_update() \ - if [ -e /etc/sysconfig/services ]; then \ - DISABLE_RESTART_ON_UPDATE= \ - . /etc/sysconfig/services \ - case "$DISABLE_RESTART_ON_UPDATE" in \ - yes|1) ;; \ - *) /usr/bin/systemctl try-restart %{*} || : \ - esac \ - fi \ -%{nil} - # Figure out when presets need to be applied. This information is only # recorded during %pre and is actually applied during %post. # @@ -148,20 +134,23 @@ if [ -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 and restart service unless +# DISABLE_RESTART_ON_UPDATE from /etc/sysconfig/services says otherwise # -# Deprecated options, please do not use in new code: -# -f : force restart on update (replaced by %service_del_postun_with_restart) -# -n : don't restart on update (replaced by %service_del_postun_without_restart) -# -# The default is to read DISABLE_RESTART_ON_UPDATE from /etc/sysconfig/services -# -%service_del_postun(fn) \ + +%service_del_postun() \ if [ -x /usr/bin/systemctl ]; then \ /usr/bin/systemctl daemon-reload || : \ if [ $1 -ge 1 ]; then \ # Package upgrade, not uninstall \ - %{expand:%%_restart_on_update%{-f:_force}%{!-f:%{-n:_never}} %{?*}} \ + DISABLE_RESTART_ON_UPDATE=no \ + [ -e /etc/sysconfig/services ] && . /etc/sysconfig/services || : \ + \ + case "$DISABLE_RESTART_ON_UPDATE" in \ + yes|1) ;; \ + *) /usr/bin/systemctl try-restart %{*} || : \ + esac \ fi \ fi \ %{nil} @@ -174,7 +163,7 @@ fi \ %systemd_post() %{expand::%%service_add_post %{?**}} %systemd_preun() %{expand::%%service_del_preun %{?**}} %systemd_postun() %{expand::%%service_del_postun_without_restart %{?**}} -%systemd_postun_with_restart() %{expand::%%service_del_postun %{?**}} +%systemd_postun_with_restart() %{expand::%%service_del_postun_with_restart %{?**}} %systemd_user_pre() \ if [ -x /usr/bin/systemctl ]; then \ diff --git a/systemd-rpm-macros.changes b/systemd-rpm-macros.changes index 5db9458..89579b5 100644 --- a/systemd-rpm-macros.changes +++ b/systemd-rpm-macros.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Wed Mar 29 11:38:07 UTC 2023 - Franck Bui + +- Bump to version 20 + +------------------------------------------------------------------- +Wed Mar 29 11:33:44 UTC 2023 - Franck Bui + +- %service_del_postun: make sure to restart services if /etc/sysconfig/service + is not present. + +------------------------------------------------------------------- +Wed Mar 29 10:40:14 UTC 2023 - Franck Bui + +- Drop support for -n/-f options in %service_del_postun + + These options have been deprecated since a long time and the last package + relying on them (drkonqi5) in the Factory repository has been updated. + ------------------------------------------------------------------- Thu Jan 26 14:12:28 UTC 2023 - Franck Bui diff --git a/systemd-rpm-macros.spec b/systemd-rpm-macros.spec index 1ce134b..c710c99 100644 --- a/systemd-rpm-macros.spec +++ b/systemd-rpm-macros.spec @@ -17,7 +17,7 @@ Name: systemd-rpm-macros -Version: 19 +Version: 20 Release: 0 Summary: RPM macros for systemd License: LGPL-2.1-or-later