From fee265e0046e85c3db0e5bb9608b666d2e9547ab Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 1 Oct 2026 17:04:21 +0200 Subject: fix(packaging): an upgrade reloads every user's systemd and restarts a running node 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 --- packaging/deb/meshbay-node/DEBIAN/postinst | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'packaging/deb/meshbay-node/DEBIAN/postinst') 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 -- cgit v1.2.3