update.sh: only turn the last exit into a reboot - #2863
Merged
Merged
Conversation
Enabling reboots after automatic updates ran sed "s|exit|...|g" on update.sh, which also replaced the early exit after the lower case check. With reboots on, "update.sh MINOR" then scheduled a reboot and ran a full (major) update instead of exiting. Disabling automatic updates deletes the lines with shutdown, so afterwards the early exit was gone completely and the same happened without reboots. Only replace the exit on the last line, so a wrong argument always exits. The updater downloads update.sh on every run and reapplies the reboot edit, so existing VMs pick this up automatically.
enoch85
force-pushed
the
fix/update-sh-exit
branch
from
September 26, 2026 14:55
9d15d91 to
86409d2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A wrong argument to update.sh must exit, but with automatic updates it can run a full (major) update instead.
Root cause: enabling reboots after automatic updates runs
sed -i "s|exit|/sbin/shutdown -r +10|g"on update.sh (addons/automatic_updates.sh,nextcloud_update.sh,menu/main_menu.sh). That also replaces the earlyexitafter the lower case check:update.sh MINORschedules a reboot and continues with the unrecognized argument, which is a major update.shutdown, so the earlyexitis gone and the same happens without reboots.Fix: only replace the
exiton the last line (sed -i '$ s|^exit$|/sbin/shutdown -r +10|'). update.sh itself is unchanged, so a wrong argument always exits.Existing installs: the updater downloads update.sh on every run and reapplies the reboot edit, so VMs pick this up automatically.
Verified: applied the old and new edits to update.sh and ran it with stubbed helpers:
MINOR-> message, reboot, update runs. After disabling: message, update runs.MINOR-> message only, in every mode (reboot enabled via the addon, the updater or the menu, and after disabling), same as without automatic updates.minor-> update and reboot as before.🤖 AI (if applicable)
Assisted-by: ClaudeCode:claude-opus-5-5