Be more defensive about systemd detection

This commit is contained in:
Jack Kingsman
2026-04-10 00:10:53 -07:00
parent 152a584f35
commit 799a721761

View File

@@ -20,10 +20,12 @@ post_upgrade() {
# Clean orphaned __pycache__ dirs left by the previous Python version
find /opt/remoteterm-meshcore -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
if command -v systemctl &>/dev/null && systemctl --version &>/dev/null 2>&1; then
systemctl daemon-reload
# Skip systemd operations in chroots/containers where the binary may exist
# but PID 1 is not systemd.
if [ -d /run/systemd/system ] && command -v systemctl &>/dev/null; then
systemctl daemon-reload || true
if systemctl is-active --quiet remoteterm-meshcore; then
systemctl restart remoteterm-meshcore
systemctl restart remoteterm-meshcore || true
fi
fi
}