diff --git a/bin/omarchy-update-pacman b/bin/omarchy-update-pacman index c9273f3c..6d3a6c4c 100755 --- a/bin/omarchy-update-pacman +++ b/bin/omarchy-update-pacman @@ -10,6 +10,7 @@ query_args=() declare -A firmware_targets needed_options sync=0 upgrades=0 ask_bits=0 repair_reboot=0 noninteractive=0 +install_operation=1 operand="" option="" end_options=0 separator_index="" @@ -40,6 +41,9 @@ for index in "${!pacman_args[@]}"; do --sysupgrade) ((upgrades += 1)) ;; --noconfirm) noninteractive=1 ;; --confirm) noninteractive=0 ;; + --print|--downloadonly) install_operation=0 ;; + --print-format) install_operation=0; operand=skip ;; + --print-format=*) install_operation=0 ;; --ask) operand=ask ;; --ask=*) mask=${arg#*=} @@ -55,6 +59,7 @@ for index in "${!pacman_args[@]}"; do --*) ;; -*) [[ $arg != *S* ]] || sync=1 + [[ $arg != *p* && $arg != *w* ]] || install_operation=0 upgrade_flags=${arg//[^u]/} ((upgrades += ${#upgrade_flags})) ;; @@ -111,11 +116,13 @@ fi if (( repair_reboot )); then sudo env "${env_args[@]}" "${scope[@]}" pacman "${pacman_args[@]}" || exit $? + (( install_operation )) || exit 0 cirrus_package=$(pacman "${query_args[@]}" -Q linux-firmware-cirrus 2>/dev/null || true) if [[ -n $cirrus_package ]] && (( $(vercmp "${cirrus_package#* }" "20260810-3") >= 0 )); then omarchy-state set reboot-required else - echo "Speaker firmware was not repaired; check the transaction's package exclusions." >&2 + echo "Speaker firmware requires linux-firmware-cirrus>=20260810-3. Check package exclusions and retry the update." >&2 + exit 1 fi else exec sudo env "${env_args[@]}" "${scope[@]}" pacman "${pacman_args[@]}" diff --git a/test/shell.d/xps13-ptl-firmware-retention-test.sh b/test/shell.d/xps13-ptl-firmware-retention-test.sh index 418276eb..771d5509 100755 --- a/test/shell.d/xps13-ptl-firmware-retention-test.sh +++ b/test/shell.d/xps13-ptl-firmware-retention-test.sh @@ -99,6 +99,9 @@ CONF } run_transaction() { local status=0 + if [[ ${RETENTION_SIMULATE_SUCCESS:-0} != 1 && ${RETENTION_INSTALL_NO_CHANGE:-0} != 1 ]]; then + set -- --print "$@" + fi PATH="$test_tmp/bin:$PATH" "$ROOT/bin/omarchy-update-pacman" "$@" >"$test_tmp/result" 2>"$test_tmp/errors" || status=$? (( status == 0 )) || cat "$test_tmp/errors" >&2 return "$status" @@ -204,3 +207,19 @@ pass "a final --confirm keeps the interactive question policy" run_transaction -Su --confirm --noconfirm [[ $(sed -n '/^--ask$/{n;p;}' "$test_tmp/transaction-args") == 1 ]] || fail "a final --noconfirm keeps noninteractive exclusions" pass "a final --noconfirm keeps noninteractive exclusions" +reset_fixture 20260810-2 +status=0 +RETENTION_INSTALL_NO_CHANGE=1 run_transaction -Su --noconfirm || status=$? +[[ $status == 1 && ! -e $test_tmp/state && $(<"$test_tmp/errors") == *'Check package exclusions and retry'* ]] || + fail "an excluded or declined installation cannot report a successful firmware repair" +pass "an excluded or declined installation fails without bypassing exclusions or requesting reboot" +for print_option in -Sup -Suw --print --downloadonly '--print-format=%n'; do + reset_fixture 20260810-2 + if [[ $print_option == -S* ]]; then + RETENTION_INSTALL_NO_CHANGE=1 run_transaction "$print_option" --noconfirm + else + RETENTION_INSTALL_NO_CHANGE=1 run_transaction -Su --noconfirm "$print_option" + fi + [[ ! -e $test_tmp/state ]] || fail "non-install modes never request reboot" +done +pass "short, long and formatted print/download-only transactions remain successful without repair"