From e7591b16ad178d368f1ff08a84b6b24fb6333d7b Mon Sep 17 00:00:00 2001 From: Roland Date: Fri, 29 May 2026 13:16:07 -0600 Subject: [PATCH] Self-heal wrolpi-upgrade.service unit before delegating in upgrade.sh upgrade.sh delegates to wrolpi-upgrade.service at the very start, but that unit is only installed by repair.sh, which runs near the end of the upgrade. On a box that has never run a repair since the unit was introduced, the delegation fails immediately with "Unit wrolpi-upgrade.service not found", the service never runs (so nothing is logged to the journal), and /opt/wrolpi/upgrade.log is never created. Install/refresh the unit from the checked-out tree and daemon-reload right before starting the service. The delegation block already runs as root, so no sudoers changes are needed. This is idempotent and also self-heals a stale unit file. Co-Authored-By: Claude Opus 4.8 (1M context) --- upgrade.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/upgrade.sh b/upgrade.sh index 4d136a78..dca4b661 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -56,6 +56,12 @@ fi if [ -z "$WROLPI_UPGRADE_SERVICE" ]; then trap 'echo ""; echo "Note: The upgrade service is still running in the background."; echo "Monitor with: journalctl -fu wrolpi-upgrade.service"' INT echo "Delegating upgrade to wrolpi-upgrade.service..." + # Self-heal: ensure the unit is installed and current before starting it. + # repair.sh installs it normally, but that runs late in the upgrade, so a + # missing or stale unit would otherwise break delegation entirely. + install -m644 /opt/wrolpi/etc/raspberrypios/wrolpi-upgrade.service \ + /etc/systemd/system/wrolpi-upgrade.service + systemctl daemon-reload # Write branch config for the service. echo "BRANCH=${BRANCH}" >/tmp/wrolpi-upgrade.env chown wrolpi:wrolpi /tmp/wrolpi-upgrade.env