Skip to content

update.sh: only turn the last exit into a reboot - #2863

Merged
enoch85 merged 2 commits into
mainfrom
fix/update-sh-exit
Sep 26, 2026
Merged

enoch85 merged 2 commits into
mainfrom
fix/update-sh-exit

Conversation

@enoch85

@enoch85 enoch85 commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

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 early exit after the lower case check:

  • With reboots on, update.sh MINOR schedules a reboot and continues with the unrecognized argument, which is a major update.
  • Disabling automatic updates deletes the lines with shutdown, so the early exit is gone and the same happens without reboots.

Fix: only replace the exit on 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:

  • old: MINOR -> message, reboot, update runs. After disabling: message, update runs.
  • new: 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)

  • The content of this PR was partly or fully generated using AI

Assisted-by: ClaudeCode:claude-opus-5-5

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 enoch85 changed the title update.sh: only exit at the end of the script update.sh: only turn the last exit into a reboot Sep 26, 2026
@enoch85
enoch85 merged commit 7d92640 into main Sep 26, 2026
9 of 10 checks passed
@enoch85
enoch85 deleted the fix/update-sh-exit branch September 26, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant