fix gateway restart for hermes
This commit is contained in:
+13
-6
@@ -3,9 +3,18 @@
|
|||||||
COREDESKTOP="$HOME/.local/share/coredesktop"
|
COREDESKTOP="$HOME/.local/share/coredesktop"
|
||||||
|
|
||||||
run_update() {
|
run_update() {
|
||||||
local status=0
|
local status=0 gateway=0
|
||||||
bash "$COREDESKTOP/sandbox/setup.sh" || status=1
|
bash "$COREDESKTOP/sandbox/setup.sh" || status=1
|
||||||
|
|
||||||
|
# Hermes update asks a running gateway to finish its work and restart, but
|
||||||
|
# that signal (SIGUSR1) reaches srt, not the gateway inside its sandbox, so
|
||||||
|
# the update would wait half an hour. Stop the gateway for the update instead;
|
||||||
|
# starting it afterwards also loads new sandbox rules and dependencies.
|
||||||
|
if systemctl --user is-active --quiet hermes-gateway.service; then
|
||||||
|
gateway=1
|
||||||
|
systemctl --user stop hermes-gateway.service || status=1
|
||||||
|
fi
|
||||||
|
|
||||||
# The real command, not the sandboxed one in sandbox/bin: updating Hermes
|
# The real command, not the sandboxed one in sandbox/bin: updating Hermes
|
||||||
# writes outside what its sandbox allows
|
# writes outside what its sandbox allows
|
||||||
if [ -x "$HOME/.local/bin/hermes" ]; then
|
if [ -x "$HOME/.local/bin/hermes" ]; then
|
||||||
@@ -13,11 +22,9 @@ run_update() {
|
|||||||
"$HOME/.local/bin/hermes" update < /dev/null || status=1
|
"$HOME/.local/bin/hermes" update < /dev/null || status=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The gateway reads its sandbox rules and loads new dependencies only when it
|
if [ "$gateway" = 1 ]; then
|
||||||
# starts, and Hermes restarts it only for new code
|
echo "Starting Hermes' gateway..."
|
||||||
if systemctl --user is-active --quiet hermes-gateway.service; then
|
systemctl --user start hermes-gateway.service || status=1
|
||||||
echo "Restarting Hermes' gateway..."
|
|
||||||
systemctl --user restart hermes-gateway.service || status=1
|
|
||||||
fi
|
fi
|
||||||
return $status
|
return $status
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user