diff --git a/src/rpm/macros.systemd.in b/src/rpm/macros.systemd.in index 1c40328db0f..24996de10ab 100644 --- a/src/rpm/macros.systemd.in +++ b/src/rpm/macros.systemd.in @@ -82,7 +82,9 @@ fi \ %{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_postun_with_restart}} \ if [ $1 -ge 1 ] && [ -x @bindir@/systemctl ]; then \ # Package upgrade, not uninstall \ - @bindir@/systemctl try-restart %{?*} || : \ + for unit in %{?*}; do \ + @bindir@/systemctl set-property $unit Markers=+needs-restart || : \ + done \ fi \ %{nil} diff --git a/src/rpm/triggers.systemd.in b/src/rpm/triggers.systemd.in index 37f62cb1b76..3a89f9169d7 100644 --- a/src/rpm/triggers.systemd.in +++ b/src/rpm/triggers.systemd.in @@ -20,6 +20,13 @@ if posix.access("/run/systemd/system") then elseif pid > 0 then posix.wait(pid) end + + pid = posix.fork() + if pid == 0 then + assert(posix.exec("%{_bindir}/systemctl", "reload-or-restart", "--marked")) + elseif pid > 0 then + posix.wait(pid) + end end %transfiletriggerpostun -P 1000100 -p -- @systemunitdir@ /etc/systemd/system @@ -37,6 +44,17 @@ if posix.access("/run/systemd/system") then end end +%transfiletriggerpostun -P 10000 -p -- @systemunitdir@ /etc/systemd/system +-- We restart remaining services that should be restarted here. +if posix.access("/run/systemd/system") then + pid = posix.fork() + if pid == 0 then + assert(posix.exec("%{_bindir}/systemctl", "reload-or-restart", "--marked")) + elseif pid > 0 then + posix.wait(pid) + end +end + %transfiletriggerin -P 100700 -p -- @sysusersdir@ -- This script will process files installed in @sysusersdir@ to create -- specified users automatically. The priority is set such that it diff --git a/src/rpm/triggers.systemd.sh.in b/src/rpm/triggers.systemd.sh.in index c1af5f43d3b..0080040de48 100644 --- a/src/rpm/triggers.systemd.sh.in +++ b/src/rpm/triggers.systemd.sh.in @@ -16,6 +16,7 @@ # so sometimes we will reload needlessly. if test -d "/run/systemd/system"; then %{_bindir}/systemctl daemon-reload || : + %{_bindir}/systemctl reload-or-restart --marked || : fi %transfiletriggerpostun -P 1000100 -- @systemunitdir@ /etc/systemd/system @@ -28,6 +29,12 @@ if test -d "/run/systemd/system"; then %{_bindir}/systemctl daemon-reload || : fi +%transfiletriggerpostun -P 10000 -- @systemunitdir@ /etc/systemd/system +# We restart remaining services that should be restarted here. +if test -d "/run/systemd/system"; then + %{_bindir}/systemctl reload-or-restart --marked || : +fi + %transfiletriggerin -P 1000700 -- @sysusersdir@ # This script will process files installed in @sysusersdir@ to create # specified users automatically. The priority is set such that it