|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
From a63d5d320f81c1cbae07897a401ed5cc5374e0bf Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
Date: Wed, 7 Jul 2021 14:37:57 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
Subject: [PATCH 4/5] rpm: restart user services at the end of the transaction
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
This closes an important gap: so far we would reexecute the system manager and
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
restart system services that were configured to do so, but we wouldn't do the
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
same for user managers or user services.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
The scheme used for user managers is very similar to the system one, except
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
that there can be multiple user managers running, so we query the system
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
manager to get a list of them, and then tell each one to do the equivalent
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
operations: daemon-reload, disable --now, set-property Markers=+needs-restart,
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
reload-or-restart --marked.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
The total time that can be spend on this is bounded: we execute the commands in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
parallel over user managers and units, and additionally set SYSTEMD_BUS_TIMEOUT
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
to a lower value (15 s by default). User managers should not have too many
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
units running, and they should be able to do all those operations very
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
quickly (<< 1s). The final restart operation may take longer, but it's done
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
asynchronously, so we only wait for the queuing to happen.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
The advantage of doing this synchronously is that we can wait for each step to
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
happen, and for example daemon-reloads can finish before we execute the service
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
restarts, etc. We can also order various steps wrt. to the phases in the rpm
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
transaction.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
When this was initially proposed, we discussed a more relaxed scheme with bus
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
property notifications. Such an approach would be more complex because a bunch
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
of infrastructure would have to be added to system manager to propagate
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
appropriate notifications to the user managers, and then the user managers
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
would have to wait for them. Instead, now there is no new code in the managers,
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
all new functionality is contained in src/rpm/. The ability to call 'systemctl
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
--user user@' makes this approach very easy. Also, it would be very hard to
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
order the user manager steps and the rpm transaction steps.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
Note: 'systemctl --user disable' is only called for a user managers that are
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
running. I don't see a nice way around this, and it shouldn't matter too much:
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
we'll just leave a dangling symlink in the case where the user enabled the
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
service manually.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
A follow-up for https://bugzilla.redhat.com/show_bug.cgi?id=1792468 and
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
fa97d2fcf64e0558054bee673f734f523373b146.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
(cherry picked from commit 36d55958ccc75fa3c91bdd7354d74c910f2f6cc7)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
meson.build | 1 +
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
meson_options.txt | 2 ++
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
src/rpm/macros.systemd.in | 6 +++-
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
src/rpm/systemd-update-helper.in | 47 ++++++++++++++++++++++++++++++++
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
src/rpm/triggers.systemd.in | 28 ++++++++++++++++++-
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
src/rpm/triggers.systemd.sh.in | 13 ++++++++-
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
6 files changed, 94 insertions(+), 3 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
diff --git a/meson.build b/meson.build
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
index fb986e84f7..d898d9ccd0 100644
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
--- a/meson.build
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+++ b/meson.build
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -270,6 +270,7 @@ conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout'))
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
conf.set_quoted('USER_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'user'))
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
diff --git a/meson_options.txt b/meson_options.txt
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
index 163c8df87d..9383c7da6a 100644
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
--- a/meson_options.txt
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+++ b/meson_options.txt
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -182,6 +182,8 @@ option('xinitrcdir', type : 'string', value : '',
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
description : 'directory for xinitrc files')
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
option('rpmmacrosdir', type : 'string', value : 'lib/rpm/macros.d',
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
description : 'directory for rpm macros ["no" disables]')
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+option('update-helper-user-timeout', type : 'string', value : '15s',
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ description : 'how long to wait for user manager operations')
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
option('pamlibdir', type : 'string',
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
description : 'directory for PAM modules')
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
option('pamconfdir', type : 'string',
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
diff --git a/src/rpm/macros.systemd.in b/src/rpm/macros.systemd.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
index bbdf036da7..caa2e45595 100644
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
--- a/src/rpm/macros.systemd.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+++ b/src/rpm/macros.systemd.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -93,7 +93,11 @@ fi \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%{nil}
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%systemd_user_postun_with_restart() \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
-%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_postun_with_restart}} \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_user_postun_with_restart}} \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+if [ $1 -ge 1 ] && [ -x "{{SYSTEMD_UPDATE_HELPER_PATH}}" ]; then \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ # Package upgrade, not uninstall \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ {{SYSTEMD_UPDATE_HELPER_PATH}} mark-restart-user-units %{?*} || : \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+fi \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%{nil}
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%udev_hwdb_update() %{nil}
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
diff --git a/src/rpm/systemd-update-helper.in b/src/rpm/systemd-update-helper.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
index f3c75b75fa..f3466ab3c0 100755
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
--- a/src/rpm/systemd-update-helper.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+++ b/src/rpm/systemd-update-helper.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -26,6 +26,15 @@ case "$command" in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
remove-user-units)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
systemctl --global disable "$@"
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ [ -d /run/systemd/system ] || exit 0
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ for user in $users; do
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT}} \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ systemctl --user -M "$user@" disable --now "$@" &
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ done
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ wait
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
;;
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
mark-restart-system-units)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -37,6 +46,17 @@ case "$command" in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
wait
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
;;
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ mark-restart-user-units)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ [ -d /run/systemd/system ] || exit 0
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ for user in $users; do
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT}} \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ systemctl --user -M "$user@" set-property "$unit" Markers=+needs-restart &
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ done
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ wait
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ ;;
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
system-reload-restart|system-reload|system-restart)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
if [ -n "$*" ]; then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
echo "Unexpected arguments for '$command': $*"
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -54,6 +74,33 @@ case "$command" in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
fi
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
;;
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ user-reload-restart|user-reload|user-restart)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ if [ -n "$*" ]; then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ echo "Unexpected arguments for '$command': $*"
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ exit 2
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ fi
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ [ -d /run/systemd/system ] || exit 0
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ if [[ "$command" =~ reload ]]; then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ for user in $users; do
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT}} \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ systemctl --user -M "$user@" daemon-reload &
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ done
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ wait
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ fi
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ if [[ "$command" =~ restart ]]; then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ for user in $users; do
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT}} \
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ systemctl --user -M "$user@" reload-or-restart --marked &
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ done
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ wait
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ fi
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ ;;
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
*)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
echo "Unknown verb '$command'"
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
exit 3
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
diff --git a/src/rpm/triggers.systemd.in b/src/rpm/triggers.systemd.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
index d29cc33dfd..8aeb2049c1 100644
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
--- a/src/rpm/triggers.systemd.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+++ b/src/rpm/triggers.systemd.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -20,6 +20,14 @@ elseif pid > 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
posix.wait(pid)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
end
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+%transfiletriggerin -P 900899 -p <lua> -- {{USER_DATA_UNIT_DIR}} /etc/systemd/user
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+pid = posix.fork()
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+if pid == 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ assert(posix.exec("{{SYSTEMD_UPDATE_HELPER_PATH}}", "user-reload-restart"))
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+elseif pid > 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ posix.wait(pid)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+end
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%transfiletriggerpostun -P 1000100 -p <lua> -- {{SYSTEM_DATA_UNIT_DIR}} /etc/systemd/system
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
-- On removal, we need to run daemon-reload after any units have been
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
-- removed.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -33,8 +41,17 @@ elseif pid > 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
posix.wait(pid)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
end
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+%transfiletriggerpostun -P 1000100 -p <lua> -- {{SYSTEM_DATA_UNIT_DIR}} /etc/systemd/system
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+-- Execute daemon-reload in user managers.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+pid = posix.fork()
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+if pid == 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ assert(posix.exec("{{SYSTEMD_UPDATE_HELPER_PATH}}", "user-reload"))
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+elseif pid > 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ posix.wait(pid)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+end
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%transfiletriggerpostun -P 10000 -p <lua> -- {{SYSTEM_DATA_UNIT_DIR}} /etc/systemd/system
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
--- We restart remaining services that should be restarted here.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+-- We restart remaining system services that should be restarted here.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
pid = posix.fork()
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
if pid == 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
assert(posix.exec("{{SYSTEMD_UPDATE_HELPER_PATH}}", "system-restart"))
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -42,6 +59,15 @@ elseif pid > 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
posix.wait(pid)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
end
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+%transfiletriggerpostun -P 9999 -p <lua> -- {{USER_DATA_UNIT_DIR}} /etc/systemd/user
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+-- We restart remaining user services that should be restarted here.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+pid = posix.fork()
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+if pid == 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ assert(posix.exec("{{SYSTEMD_UPDATE_HELPER_PATH}}", "user-restart"))
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+elseif pid > 0 then
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+ posix.wait(pid)
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+end
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%transfiletriggerin -P 100700 -p <lua> -- {{SYSUSERS_DIR}}
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
-- This script will process files installed in {{SYSUSERS_DIR}} to create
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
-- specified users automatically. The priority is set such that it
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
diff --git a/src/rpm/triggers.systemd.sh.in b/src/rpm/triggers.systemd.sh.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
index 83cd7617f8..694cd94e8d 100644
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
--- a/src/rpm/triggers.systemd.sh.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+++ b/src/rpm/triggers.systemd.sh.in
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -16,6 +16,9 @@
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
# so sometimes we will reload needlessly.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
{{SYSTEMD_UPDATE_HELPER_PATH}} system-reload-restart || :
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+%transfiletriggerin -P 900899 -- {{USER_DATA_UNIT_DIR}} /etc/systemd/user
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+{{SYSTEMD_UPDATE_HELPER_PATH}} user-reload-restart || :
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%transfiletriggerpostun -P 1000100 -- {{SYSTEM_DATA_UNIT_DIR}} /etc/systemd/system
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
# On removal, we need to run daemon-reload after any units have been
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
# removed.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
@@ -24,10 +27,18 @@
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
# executed.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
{{SYSTEMD_UPDATE_HELPER_PATH}} system-reload || :
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+%transfiletriggerpostun -P 1000099 -- {{USER_DATA_UNIT_DIR}} /etc/systemd/user
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+# Execute daemon-reload in user managers.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+{{SYSTEMD_UPDATE_HELPER_PATH}} user-reload || :
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%transfiletriggerpostun -P 10000 -- {{SYSTEM_DATA_UNIT_DIR}} /etc/systemd/system
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
-# We restart remaining services that should be restarted here.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+# We restart remaining system services that should be restarted here.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
{{SYSTEMD_UPDATE_HELPER_PATH}} system-restart || :
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+%transfiletriggerpostun -P 9999 -- {{USER_DATA_UNIT_DIR}} /etc/systemd/user
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+# We restart remaining user services that should be restarted here.
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+{{SYSTEMD_UPDATE_HELPER_PATH}} user-restart || :
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
%transfiletriggerin -P 1000700 -- {{SYSUSERS_DIR}}
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
# This script will process files installed in {{SYSUSERS_DIR}} to create
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
# specified users automatically. The priority is set such that it
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
--
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
2.31.1
|
|
Zbigniew Jędrzejewski-Szmek |
7a99d8 |
|