naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
3e5297
From 37cd6c0fad847e5fffd9d107358a36e767c7ca42 Mon Sep 17 00:00:00 2001
3e5297
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
3e5297
Date: Fri, 23 Jul 2021 15:35:23 +0200
3e5297
Subject: [PATCH 5/5] update-helper: also add "user-reexec" verb
3e5297
3e5297
This is not called from the systemd.triggers or systemd.macros files. Instead,
3e5297
it would be called from the scriptlets in systemd rpm package itself, at the
3e5297
place where we call systemctl daemon-reexec.
3e5297
3e5297
See https://github.com/systemd/systemd/pull/20289#issuecomment-885622200 .
3e5297
3e5297
(cherry picked from commit 1262e824a4d638e347ae0d39c973f1f750962533)
3e5297
---
3e5297
 src/rpm/systemd-update-helper.in | 10 +++++++++-
3e5297
 1 file changed, 9 insertions(+), 1 deletion(-)
3e5297
3e5297
diff --git a/src/rpm/systemd-update-helper.in b/src/rpm/systemd-update-helper.in
3e5297
index f3466ab3c0..0c6675a9db 100755
3e5297
--- a/src/rpm/systemd-update-helper.in
3e5297
+++ b/src/rpm/systemd-update-helper.in
3e5297
@@ -74,7 +74,7 @@ case "$command" in
3e5297
         fi
3e5297
         ;;
3e5297
 
3e5297
-    user-reload-restart|user-reload|user-restart)
3e5297
+    user-reload-restart|user-reload|user-restart|user-reexec)
3e5297
         if [ -n "$*" ]; then
3e5297
             echo "Unexpected arguments for '$command': $*"
3e5297
             exit 2
3e5297
@@ -84,6 +84,14 @@ case "$command" in
3e5297
 
3e5297
         users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
3e5297
 
3e5297
+        if [[ "$command" =~ reexec ]]; then
3e5297
+            for user in $users; do
3e5297
+                SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT}} \
3e5297
+                        systemctl --user -M "$user@" daemon-reexec &
3e5297
+            done
3e5297
+            wait
3e5297
+        fi
3e5297
+
3e5297
         if [[ "$command" =~ reload ]]; then
3e5297
             for user in $users; do
3e5297
                 SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT}} \
3e5297
-- 
3e5297
2.31.1
3e5297