systemd: perform reload even in degraded state

This fixes , fixes , and fixes .
This commit is contained in:
Robert Helgesson 2019-11-17 21:16:28 +01:00
parent 9e716025b6
commit 9781f3766d
Failed to generate hash of commit

View file

@ -242,15 +242,27 @@ in
''; '';
ensureRuntimeDir = "XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"; ensureRuntimeDir = "XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$(id -u)}";
systemctl = "${ensureRuntimeDir} ${cfg.systemctlPath}";
in in
'' ''
if ${ensureRuntimeDir} ${cfg.systemctlPath} --quiet --user is-system-running 2> /dev/null; then systemdStatus=$(${systemctl} --user is-system-running 2>&1 || true)
if [[ $systemdStatus == 'running' || $systemdStatus == 'degraded' ]]; then
if [[ $systemdStatus == 'degraded' ]]; then
warnEcho "The user systemd session is degraded:"
systemctl --user --state=failed
warnEcho "Attempting to reload services anyway..."
fi
${ensureRuntimeDir} \ ${ensureRuntimeDir} \
PATH=${dirOf cfg.systemctlPath}:$PATH \ PATH=${dirOf cfg.systemctlPath}:$PATH \
${if cfg.startServices then autoReloadCmd else legacyReloadCmd} ${if cfg.startServices then autoReloadCmd else legacyReloadCmd}
else else
echo "User systemd daemon not running. Skipping reload." echo "User systemd daemon not running. Skipping reload."
fi fi
unset systemdStatus
'' ''
); );
}) })