From 4fa9b4b2579566bd17b63c19be3700ba95746a95 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 21 Sep 2012 14:58:28 -0400 Subject: [PATCH] Restart systemd if necessary --- modules/system/activation/switch-to-configuration.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/system/activation/switch-to-configuration.pl b/modules/system/activation/switch-to-configuration.pl index ff083156ca2d..6542b48c54e0 100644 --- a/modules/system/activation/switch-to-configuration.pl +++ b/modules/system/activation/switch-to-configuration.pl @@ -232,7 +232,11 @@ my $res = 0; print STDERR "activating the configuration...\n"; system("@out@/activate", "@out@") == 0 or $res = 2; -# FIXME: Re-exec systemd if necessary. +# Restart systemd if necessary. +if (abs_path("/proc/1/exe") ne abs_path("@systemd@/lib/systemd/systemd")) { + print STDERR "restarting systemd...\n"; + system("@systemd@/bin/systemctl", "daemon-reexec") == 0 or $res = 2; +} # Forget about previously failed services. system("@systemd@/bin/systemctl", "reset-failed");