]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
rpm/systemd-update-helper: Use systemctl reload to reexec/reload user managers 34707/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 10 Oct 2024 20:37:39 +0000 (22:37 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 11 Oct 2024 08:36:08 +0000 (10:36 +0200)
Let's always use systemctl reload to reexec and reload user managers
now that it always implies a reexec. This moves all the job management
logic to pid 1 instead of bash and reduces the complexity of the logic
as we remove systemd-run, pam and systemd-stdio-bridge from the equation.

src/rpm/systemd-update-helper.in

index c81e16c3d3ffb68c7c07add817d49ff786eeac4d..8af914935261ac669f3e0a746ab55e455d11e3f9 100755 (executable)
@@ -107,25 +107,13 @@ case "$command" in
 
         [ -d /run/systemd/system ] || exit 0
 
-        users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
-
-        if [[ "$command" =~ reexec ]]; then
-            for user in $users; do
-                SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT_SEC}}s \
-                        systemctl --user -M "$user@" daemon-reexec &
-            done
-            wait
-        fi
-
-        if [[ "$command" =~ reload ]]; then
-            for user in $users; do
-                SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT_SEC}}s \
-                        systemctl --user -M "$user@" daemon-reload &
-            done
-            wait
+        if [[ "$command" =~ reexec|reload ]]; then
+            SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT_SEC}}s systemctl reload "user@*.service"
         fi
 
         if [[ "$command" =~ restart ]]; then
+            users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
+
             for user in $users; do
                 SYSTEMD_BUS_TIMEOUT={{UPDATE_HELPER_USER_TIMEOUT_SEC}}s \
                         systemctl --user -M "$user@" reload-or-restart --marked &