diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-01 17:04:21 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-01 17:04:21 +0200 |
| commit | fee265e0046e85c3db0e5bb9608b666d2e9547ab (patch) | |
| tree | 11eb8906fd3dc6f193eaf91cf98b6d7d0bedc5a5 /packaging/deb/meshbay-node/DEBIAN/postinst | |
| parent | 03f560bb4aaeda0e06c95684c187a394593c88e3 (diff) | |
| download | meshbay-fee265e0046e85c3db0e5bb9608b666d2e9547ab.tar.gz | |
The node runs as a user service; the system-wide daemon-reload did not reach
the user managers, so systemctl warned that the unit had changed and the old
code kept running until restarted by hand. The deb postinst and the rpm
%posttrans reload each running user manager and try-restart the node there
(and any meshbay-node@ instance) on an upgrade.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packaging/deb/meshbay-node/DEBIAN/postinst')
| -rw-r--r-- | packaging/deb/meshbay-node/DEBIAN/postinst | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/packaging/deb/meshbay-node/DEBIAN/postinst b/packaging/deb/meshbay-node/DEBIAN/postinst index ba16633..f78cf6c 100644 --- a/packaging/deb/meshbay-node/DEBIAN/postinst +++ b/packaging/deb/meshbay-node/DEBIAN/postinst @@ -1,11 +1,30 @@ #!/bin/sh set -e +# The node runs as a user service, in every signed-in user's own systemd +# manager: the system-wide reload does not reach those, and each would keep +# the old unit and the old code until restarted by hand. Every running user +# manager reloads, and restarts the node where it was running. +reload_user_managers() { + for bus in /run/user/*/systemd/private; do + [ -S "$bus" ] || continue + uid=$(basename "$(dirname "$(dirname "$bus")")") + user=$(id -nu "$uid" 2>/dev/null) || continue + systemctl --user -M "$user@" daemon-reload 2>/dev/null || true + [ -n "$1" ] && systemctl --user -M "$user@" try-restart meshbay-node.service 2>/dev/null || true + done +} + case "$1" in configure) - # Reload systemd if available if [ -d /run/systemd/system ]; then systemctl daemon-reload || true + # $2 is the version replaced: on an upgrade, a running node + # restarts onto the new code. + if [ -n "$2" ]; then + systemctl try-restart 'meshbay-node@*.service' 2>/dev/null || true + fi + reload_user_managers "$2" fi ;; esac |