Skip to content

console: item 5 is the updater on an installed machine - check, signed install, reboot offer, roll back, channel (OS updater U4) - #3445

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl-release/updater-menu
Nov 24, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl-release/updater-menu

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

OS updater, brief OS-UPDATER.md item 4. Uses 1bit-update --check (U1, #3441, merged) and --latest (U2, #3444, open). This PR's tests use a fake 1bit-update, so they don't depend on #3444. Installs from the menu work once #3444 merges.

On an INSTALLED machine, item 5 is now "Update / roll back 1bit OS":

  1. Check for an update (and install it): shows 1bit-update --check. When an update is available and signed, a confirm names the version and the download size, then 1bit-update --latest --channel <ch> runs (signed download into the other slot), then "Reboot now?". No means it runs at the next reboot, and this version stays as the rollback.
  2. Roll back to the previous version: shows --status, confirm, --rollback, then a reboot offer.
  3. Update channel: stable ↔ test, stored in /data/1bit/update.conf. Switching to test asks first.
  4. Install 1bit OS onto a DIFFERENT disk: the previous item 5, unchanged.

A live stick keeps "Install 1bit OS to a disk". On an installed machine, --run 5 only checks, and still prints install-guard-checked for vm-check's U2 menu actions row.

Safety: the menu's yesno answers yes when dialog is missing. That's right for showing a key, wrong for replacing the OS. So installs and rollbacks use a new confirm: default no, a typed y on a text terminal, and always no non-interactively. An unsigned release is never offered. ONEBIT_MENU_LIB=1 sources the functions for tests.

Measured: tests/console_update_test.sh (new, ctest console_update) runs the text-terminal path with a fake 1bit-update that records its calls. It covers confirm semantics (non-interactive no, y yes, Enter no), check-only --run 5, install on y / nothing on n, the reboot offer both ways, an unsigned release not offered, rollback, the channel toggle both ways, and the label. 12/12 under dash (env -i) and busybox ash. console_chain: 0 failures. Pre-PR checks after committing: 17 green, 3 skipped.

🤖 Generated with Claude Code

…d install, reboot offer, roll back, channel (OS updater U4)

Brief OS-UPDATER.md item 4. On an INSTALLED machine item 5 ('Update / roll back 1bit OS') opens:
  1 Check for an update (and install it): 1bit-update --check shown; when an update is available AND signed, a
    confirm names the version and download size, then 1bit-update --latest --channel <ch> (signed download -> the
    other slot), then 'Reboot now?' (no = at the next reboot; this version stays as the rollback);
  2 Roll back to the previous version: --status shown, confirm, --rollback, reboot offer;
  3 Update channel stable <-> test, in /data/1bit/update.conf (switching to test asks first);
  4 Install onto a DIFFERENT disk (the previous item 5, unchanged).
A live stick keeps 'Install 1bit OS to a disk'. --run 5 on an installed machine only CHECKS (and still prints
install-guard-checked for vm-check's U2 row).

Safety: the menu's yesno answers yes when dialog is missing (right for showing a key, wrong for replacing an OS), so
installs and rollbacks use a new confirm: default no, a typed y on a text terminal, ALWAYS no non-interactively. An
unsigned release is never offered. ONEBIT_MENU_LIB=1 sources the functions for tests.

tests/console_update_test.sh (new, ctest console_update): text-terminal path with a fake 1bit-update - confirm
semantics, check-only --run 5, y/n install, reboot offer, unsigned not offered, rollback, channel toggle, the label:
12/12 under dash (env -i) and busybox ash. console_chain: 0 failures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Potential Incorrect Default Behavior in `confirm` Function

The confirm function uses dialog_ok to determine whether to use dialog or fall back to a text-based input. However, in non-interactive mode (NONINT=1), it always returns 1 (no), which is correct. But in interactive mode, if dialog is not available, it falls back to reading from stdin. The fallback behavior assumes that a typed 'y' is a valid confirmation, but it does not explicitly check for a newline or other input terminators, which could lead to unexpected behavior if the input stream is not properly terminated or if there are issues with the terminal session.

confirm() {   # confirm <question> -> 0 only on a person's yes
    [ "$NONINT" = 1 ] && return 1
    if dialog_ok; then ui --title " 1bit OS " --defaultno --yesno "$1" 12 72; return; fi
    printf '\n%s\n  [y/N] ' "$1"; read -r _a || _a=""
    case $_a in y|Y|yes|YES) return 0 ;; *) return 1 ;; esac
}
Incorrect Handling of Update Channel Toggle

The item_update function handles the channel toggle (item 3) by checking if the current channel is 'stable' and setting the new channel to 'test', or vice versa. However, it does not validate that the channel values are one of the expected values ('stable' or 'test'). This could lead to unexpected behavior if the configuration file contains invalid channel values.

    3)
        new=stable; [ "$ch" = stable ] && new=test
        [ "$new" = test ] && { confirm "Switch to the TEST channel?

Test builds (pre-releases such as v2026.49-rc1) are for trying things out before a release." || return 0; }
        mkdir -p "$(dirname "$UPDATE_CONF")" &&
            { grep -v '^channel=' "$UPDATE_CONF" 2> /dev/null; echo "channel=$new"; } > "$UPDATE_CONF.new" &&
            mv "$UPDATE_CONF.new" "$UPDATE_CONF" && say "update channel: $new" ;;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant