diff --git a/macros.systemd b/macros.systemd index 396dbfb..e7e4001 100644 --- a/macros.systemd +++ b/macros.systemd @@ -134,17 +134,19 @@ if [ -x /usr/bin/systemctl ]; then \ fi \ %{nil} -# On uninstall, tell systemd to reload its unit files -# -# The default is to read DISABLE_RESTART_ON_UPDATE from /etc/sysconfig/services +# 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 # + %service_del_postun() \ if [ -x /usr/bin/systemctl ]; then \ /usr/bin/systemctl daemon-reload || : \ - if [ $1 -ge 1 ] && [ -e /etc/sysconfig/services ]; then \ + if [ $1 -ge 1 ]; then \ # Package upgrade, not uninstall \ - DISABLE_RESTART_ON_UPDATE= \ - . /etc/sysconfig/services \ + 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 %{*} || : \ @@ -161,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 1a9ac0b..2b281e9 100644 --- a/systemd-rpm-macros.changes +++ b/systemd-rpm-macros.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +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