From 0d8232b9db162fe7d9db774ea8e2cebc62051ecd Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Tue, 6 Oct 2026 21:29:54 -0500 Subject: [PATCH] Install the XPS 13 PTL speaker alias package Install the separately owned firmware aliases through the package helper so stock firmware updates and stable refreshes retain them. Use a distinct migration to reach machines with the prior migration completed and preserve the reboot prompt until reboot. Restore the generic updater and leave display quirks to the kernel. Co-Authored-By: Codex GPT-6.1-Sol XHigh --- bin/omarchy-update-pacman | 106 +-------- install/hardware/all.sh | 1 - install/hardware/dell-xps13-ptl-display.sh | 13 - .../dell-xps13-ptl-speaker-firmware.sh | 10 +- install/omarchy-other.packages | 3 +- migrations/1790916392.sh | 25 -- migrations/{1790904845.sh => 1791265613.sh} | 0 test/shell.d/fixtures/sudo-boundary-test.sh | 2 - test/shell.d/update-package-conflict-test.sh | 23 -- test/shell.d/update-pacman-test.sh | 2 - test/shell.d/xps13-ptl-display-test.sh | 142 ----------- .../xps13-ptl-firmware-retention-test.sh | 225 ------------------ test/shell.d/xps13-ptl-firmware-test.sh | 96 ++------ 13 files changed, 28 insertions(+), 620 deletions(-) delete mode 100644 install/hardware/dell-xps13-ptl-display.sh delete mode 100644 migrations/1790916392.sh rename migrations/{1790904845.sh => 1791265613.sh} (100%) delete mode 100755 test/shell.d/xps13-ptl-display-test.sh delete mode 100755 test/shell.d/xps13-ptl-firmware-retention-test.sh diff --git a/bin/omarchy-update-pacman b/bin/omarchy-update-pacman index 6d3a6c4c..66f66731 100755 --- a/bin/omarchy-update-pacman +++ b/bin/omarchy-update-pacman @@ -5,98 +5,6 @@ # omarchy:hidden=true # omarchy:requires-sudo=true -pacman_args=("$@") -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="" -for index in "${!pacman_args[@]}"; do - arg=${pacman_args[index]} - if [[ -n $operand ]]; then - if [[ $operand == "query" ]]; then - query_args+=("$option" "$arg") - elif [[ $operand == "ask" ]]; then - [[ $arg =~ ^[0-9]{1,10}$ ]] || { echo "Invalid pacman question mask: $arg" >&2; exit 2; } - ask_bits=$((10#$arg)) - noninteractive=1 - fi - operand="" - continue - fi - if [[ $arg == "--" ]]; then - end_options=1 - separator_index=$index - continue - fi - if (( end_options )); then - [[ $arg != "linux-firmware-cirrus" && $arg != */linux-firmware-cirrus ]] || firmware_targets[$index]=1 - continue - fi - case "$arg" in - --sync) sync=1 ;; - --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#*=} - [[ $mask =~ ^[0-9]{1,10}$ ]] || { echo "Invalid pacman question mask: $mask" >&2; exit 2; } - ask_bits=$((10#$mask)) - noninteractive=1 - ;; - --config|--dbpath|--root|--sysroot|-b|-r) operand=query; option=$arg ;; - --config=*|--dbpath=*|--root=*|--sysroot=*) query_args+=("$arg") ;; - --ignore|--ignoregroup|--cachedir|--hookdir|--gpgdir|--logfile|--overwrite) operand=skip ;; - -b?*|-r?*) query_args+=("$arg") ;; - --needed) needed_options[$index]=1 ;; - --*) ;; - -*) - [[ $arg != *S* ]] || sync=1 - [[ $arg != *p* && $arg != *w* ]] || install_operation=0 - upgrade_flags=${arg//[^u]/} - ((upgrades += ${#upgrade_flags})) - ;; - linux-firmware-cirrus|*/linux-firmware-cirrus) firmware_targets[$index]=1 ;; - esac -done - -if (( sync && upgrades )) && omarchy-hw-dell-xps13-dx13260-ptl; then - cirrus_package=$(pacman "${query_args[@]}" -Q linux-firmware-cirrus 2>/dev/null || true) - old_firmware=0 - if [[ -z $cirrus_package ]] || (( $(vercmp "${cirrus_package#* }" "20260810-3") < 0 )); then - old_firmware=1 - fi - if (( upgrades > 1 || old_firmware || ${#firmware_targets[@]} )); then - pacman_args=() - original_args=("$@") - policy_inserted=0 - for index in "${!original_args[@]}"; do - arg=${original_args[index]} - if (( noninteractive )) && [[ $index == "$separator_index" ]]; then - pacman_args+=(--ask "$((ask_bits | 1))") - policy_inserted=1 - fi - [[ ! -v firmware_targets[$index] ]] || continue - # --needed skips an installed shim before -Suu selects the older core copy. - (( upgrades < 2 )) || [[ ! -v needed_options[$index] ]] || continue - pacman_args+=("$arg") - done - # Keep exclusions through pacman's own IgnorePkg/IgnoreGroup question handling. - if (( noninteractive && ! policy_inserted )); then - pacman_args+=(--ask "$((ask_bits | 1))") - fi - pacman_args+=('linux-firmware-cirrus>=20260810-3') - repair_reboot=$old_firmware - fi -fi - # Upgrading systemd runs its post_upgrade scriptlet mid-transaction, which # reexecs both the system manager and every user manager. A pacman running # inside a user-session scope can be SIGKILLed by that reexec, abandoning the @@ -114,16 +22,4 @@ if [[ -n ${LC_ALL:-} ]]; then env_args+=(LC_ALL="$LC_ALL") 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 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[@]}" -fi +exec sudo env "${env_args[@]}" "${scope[@]}" pacman "$@" diff --git a/install/hardware/all.sh b/install/hardware/all.sh index 4394cc09..92f3fdea 100644 --- a/install/hardware/all.sh +++ b/install/hardware/all.sh @@ -19,7 +19,6 @@ run_logged "$OMARCHY_INSTALL/hardware/intel/fred.sh" run_logged "$OMARCHY_INSTALL/hardware/intel/fix-wifi7-eht.sh" run_logged "$OMARCHY_INSTALL/hardware/intel/sof-firmware.sh" run_logged "$OMARCHY_INSTALL/hardware/dell-xps13-ptl-speaker-firmware.sh" -run_logged "$OMARCHY_INSTALL/hardware/dell-xps13-ptl-display.sh" run_logged "$OMARCHY_INSTALL/hardware/fix-elgato-camlink-4k.sh" diff --git a/install/hardware/dell-xps13-ptl-display.sh b/install/hardware/dell-xps13-ptl-display.sh deleted file mode 100644 index 8affe0c5..00000000 --- a/install/hardware/dell-xps13-ptl-display.sh +++ /dev/null @@ -1,13 +0,0 @@ -if omarchy-hw-dell-xps13-dx13260-ptl; then - display_conf="/etc/limine-entry-tool.d/dell-xps13-ptl-display.conf" - display_rebuild_marker="/var/lib/omarchy/migrations/1790916392" - display_cmdline='KERNEL_CMDLINE[default]+=" xe.enable_psr2_sel_fetch=0 xe.enable_panel_replay=0"' - - if [[ ! -f $display_conf ]] || ! grep -Fxq "$display_cmdline" "$display_conf"; then - # A repaired drop-in invalidates the previous boot image rebuild. - sudo rm -f "$display_rebuild_marker" - sudo mkdir -p /etc/limine-entry-tool.d - printf '%s\n' '# Dell XPS 13 Panther Lake display workaround' "$display_cmdline" | - sudo tee "$display_conf" >/dev/null - fi -fi diff --git a/install/hardware/dell-xps13-ptl-speaker-firmware.sh b/install/hardware/dell-xps13-ptl-speaker-firmware.sh index bd04e746..df9db731 100644 --- a/install/hardware/dell-xps13-ptl-speaker-firmware.sh +++ b/install/hardware/dell-xps13-ptl-speaker-firmware.sh @@ -1,13 +1,7 @@ if omarchy-hw-dell-xps13-dx13260-ptl; then - cirrus_package=$(pacman -Q linux-firmware-cirrus 2>/dev/null || true) - - # Keep newer Arch firmware when stable's snapshot supersedes the shim. - if [[ -z $cirrus_package ]] || (( $(vercmp "${cirrus_package#* }" "20260810-3") < 0 )); then + if omarchy-pkg-missing linux-firmware-cirrus-dx13260; then firmware_pending="/run/omarchy/xps13-ptl-speaker-firmware" sudo install -Dm644 /dev/null "$firmware_pending" - - # omarchy-pkg-add skips installed packages and cannot verify repo-qualified targets. - # Select [omarchy] explicitly because [core] carries the older firmware. - sudo pacman -S --noconfirm --needed omarchy/linux-firmware-cirrus fi + omarchy-pkg-add linux-firmware-cirrus-dx13260 fi diff --git a/install/omarchy-other.packages b/install/omarchy-other.packages index 65abbbe2..1e70cb71 100644 --- a/install/omarchy-other.packages +++ b/install/omarchy-other.packages @@ -59,8 +59,7 @@ linux-firmware-marvell # Dell laptop support packages dell-xps-touchpad-haptics dell-xps13-sidecar-amps -# Select the stable-snapshot shim or newer Arch firmware for the XPS 13 PTL. -linux-firmware-cirrus>=20260810-3 +linux-firmware-cirrus-dx13260 # Speaker tunings (LV2 limiter every tuning ends in) lsp-plugins-lv2 diff --git a/migrations/1790916392.sh b/migrations/1790916392.sh deleted file mode 100644 index eb11d98c..00000000 --- a/migrations/1790916392.sh +++ /dev/null @@ -1,25 +0,0 @@ -echo "Apply the Dell XPS 13 Panther Lake display workaround" - -if omarchy-hw-dell-xps13-dx13260-ptl; then - source "$OMARCHY_PATH/install/hardware/dell-xps13-ptl-display.sh" - - # Record a successful machine-wide rebuild so other users do not repeat it. - if [[ ! -e $display_rebuild_marker ]]; then - if ! display_rebuild_output=$(sudo limine-mkinitcpio 2>&1); then - printf '%s\n' "$display_rebuild_output" >&2 - exit 1 - fi - printf '%s\n' "$display_rebuild_output" - - # Limine reports per-kernel build errors on stderr but can still exit zero. - if [[ $display_rebuild_output == *"ERROR:"* ]]; then - exit 1 - fi - sudo install -Dm644 /dev/null "$display_rebuild_marker" - fi - - if ! grep -Eq '(^| )xe.enable_psr2_sel_fetch=0( |$)' /proc/cmdline || - ! grep -Eq '(^| )xe.enable_panel_replay=0( |$)' /proc/cmdline; then - omarchy-state set reboot-required - fi -fi diff --git a/migrations/1790904845.sh b/migrations/1791265613.sh similarity index 100% rename from migrations/1790904845.sh rename to migrations/1791265613.sh diff --git a/test/shell.d/fixtures/sudo-boundary-test.sh b/test/shell.d/fixtures/sudo-boundary-test.sh index 544d2482..1fb123d0 100644 --- a/test/shell.d/fixtures/sudo-boundary-test.sh +++ b/test/shell.d/fixtures/sudo-boundary-test.sh @@ -32,8 +32,6 @@ PY copy_boundary_file bin/omarchy-security-functions copy_boundary_file bin/omarchy-update-pacman copy_boundary_file default/omarchy/sudo-no-update/sudo -printf '#!/bin/bash\nexit 1\n' >"$SUDO_TEST_ROOT/bin/omarchy-hw-dell-xps13-dx13260-ptl" -chmod +x "$SUDO_TEST_ROOT/bin/omarchy-hw-dell-xps13-dx13260-ptl" cat >"$SUDO_TEST_ROOT/mock/sudo" <<'STUB' #!/bin/bash diff --git a/test/shell.d/update-package-conflict-test.sh b/test/shell.d/update-package-conflict-test.sh index 2f0d7053..e05e8f7b 100755 --- a/test/shell.d/update-package-conflict-test.sh +++ b/test/shell.d/update-package-conflict-test.sh @@ -31,12 +31,6 @@ STUB # for a person has to keep that stream. cat >"$stub_bin/pacman" <<'STUB' #!/bin/bash -if [[ $1 == "-Q" ]]; then - version=20260810-2 - (( $(cat "$PACMAN_ATTEMPTS") < 2 )) || version=20260810-3 - printf 'linux-firmware-cirrus %s\n' "$version" - exit 0 -fi attempt=$(($(cat "$PACMAN_ATTEMPTS") + 1)) echo "$attempt" >"$PACMAN_ATTEMPTS" { @@ -53,16 +47,7 @@ fi echo "upgrade complete" STUB -cat >"$stub_bin/omarchy-hw-dell-xps13-dx13260-ptl" <<'STUB' -#!/bin/bash -[[ ${TEST_PTL_MATCH:-0} == 1 ]] -STUB -cat >"$stub_bin/omarchy-state" <<'STUB' -#!/bin/bash -exit 0 -STUB chmod +x "$stub_bin/sudo" "$stub_bin/systemd-run" "$stub_bin/pacman" -chmod +x "$stub_bin/omarchy-hw-dell-xps13-dx13260-ptl" "$stub_bin/omarchy-state" # Everything a blocked qemu-common upgrade leaves on stderr, and no more. The # ":: ... Remove qemu-block-gluster? [y/N]" pacman asked is deliberately absent: @@ -176,11 +161,3 @@ fi [[ $(call_line 1 args) == *"--noconfirm"* ]] || fail "a caller can ask for an interactive upgrade directly" pass "only the conflict handler can hand the upgrade to a person" - -write_conflict_report -TEST_PTL_MATCH=1 run_on_terminal || fail "the firmware minimum blocks interactive conflict recovery" -[[ $(call_line 1 args) == *'linux-firmware-cirrus>=20260810-3'* && $(call_line 1 args) == *'--ask 1'* ]] || - fail "the first matching-hardware transaction retains its firmware and exclusion policy" -[[ $(call_line 2 args) == *'linux-firmware-cirrus>=20260810-3'* && $(call_line 2 args) != *'--ask'* && $(call_line 2 args) != *'--noconfirm'* ]] || - fail "the matching-hardware conflict retry must let the person answer" -pass "Panther Lake firmware repair preserves interactive package conflict recovery" diff --git a/test/shell.d/update-pacman-test.sh b/test/shell.d/update-pacman-test.sh index 9f2b088c..8af6766c 100755 --- a/test/shell.d/update-pacman-test.sh +++ b/test/shell.d/update-pacman-test.sh @@ -15,8 +15,6 @@ cat >"$stub_bin/sudo" <<'STUB' printf '%s\n' "$*" >"$SUDO_CALL_LOG" STUB chmod +x "$stub_bin/sudo" -printf '#!/bin/bash\nexit 1\n' >"$stub_bin/omarchy-hw-dell-xps13-dx13260-ptl" -chmod +x "$stub_bin/omarchy-hw-dell-xps13-dx13260-ptl" run_helper() { PATH="$stub_bin:$PATH" SUDO_CALL_LOG="$test_tmp/call" "$ROOT/bin/omarchy-update-pacman" "$@" diff --git a/test/shell.d/xps13-ptl-display-test.sh b/test/shell.d/xps13-ptl-display-test.sh deleted file mode 100755 index 7d96deae..00000000 --- a/test/shell.d/xps13-ptl-display-test.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash - -set -euo pipefail -source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" - -leaf="$ROOT/install/hardware/dell-xps13-ptl-display.sh" -migration="$ROOT/migrations/1790916392.sh" - -grep -Fq 'run_logged "$OMARCHY_INSTALL/hardware/dell-xps13-ptl-display.sh"' "$ROOT/install/hardware/all.sh" || - fail "hardware setup applies the XPS 13 Panther Lake display workaround" -pass "hardware setup applies the XPS 13 Panther Lake display workaround" - -test_tmp=$(mktemp -d) -trap 'rm -rf "$test_tmp"' EXIT -export OMARCHY_PATH="$test_tmp/omarchy" -mkdir -p "$test_tmp/bin" "$OMARCHY_PATH/install/hardware" - -# Redirect fixed production paths only in temporary source copies. -redirect_path() { - local literal replacement - printf -v literal '%q' "$2" - replacement=$(printf '%s' "$literal" | sed 's/[\\&|]/\\&/g') - sed "s|$1|$replacement|g" -} - -display_conf="$test_tmp/limine/dell-xps13-ptl-display.conf" -rebuild_marker="$test_tmp/rebuilt" -running_cmdline="$test_tmp/cmdline" -redirect_path '"/etc/limine-entry-tool.d/dell-xps13-ptl-display.conf"' "$display_conf" <"$leaf" | - redirect_path '"/var/lib/omarchy/migrations/1790916392"' "$rebuild_marker" | - redirect_path '/etc/limine-entry-tool.d$' "$test_tmp/limine" >"$OMARCHY_PATH/install/hardware/${leaf##*/}" -redirect_path '/proc/cmdline' "$running_cmdline" <"$migration" >"$test_tmp/migration.sh" - -cat >"$test_tmp/bin/omarchy-hw-match" <<'SH' -#!/bin/bash -[[ $TEST_MODEL == *"$1"* ]] -SH -cat >"$test_tmp/bin/omarchy-hw-intel-ptl" <<'SH' -#!/bin/bash -[[ $TEST_PTL == "1" ]] -SH -cat >"$test_tmp/bin/sudo" <<'SH' -#!/bin/bash -printf 'sudo %s\n' "$*" >>"$TEST_LOG" -exec "$@" -SH -cat >"$test_tmp/bin/limine-mkinitcpio" <<'SH' -#!/bin/bash -if [[ ${TEST_REBUILD_ERROR:-0} == "1" ]]; then - printf '\033[31mERROR: mkinitcpio failed for kernel fixture, skipping.\033[0m\n' >&2 - exit 0 -fi -declare -A KERNEL_CMDLINE=([default]="root=UUID=keep quiet") -source "$TEST_DISPLAY_CONF" -printf '%s\n' "${KERNEL_CMDLINE[default]}" >"$TEST_IMAGE_CMDLINE" -exit "${TEST_REBUILD_STATUS:-0}" -SH -cat >"$test_tmp/bin/omarchy-state" <<'SH' -#!/bin/bash -printf 'state %s\n' "$*" >>"$TEST_LOG" -SH -chmod +x "$test_tmp/bin/"* -export PATH="$test_tmp/bin:$ROOT/bin:$PATH" -export TEST_LOG="$test_tmp/calls" TEST_MODEL="XPS 13 DX13260" TEST_PTL=1 -export TEST_DISPLAY_CONF="$display_conf" TEST_IMAGE_CMDLINE="$test_tmp/image-cmdline" -printf '%s\n' 'root=UUID=keep quiet' >"$running_cmdline" - -run_leaf() { - : >"$TEST_LOG" - bash -euo pipefail -c 'source "$1"' bash "$OMARCHY_PATH/install/hardware/${leaf##*/}" -} -run_migration() { - : >"$TEST_LOG" - bash -euo pipefail "$test_tmp/migration.sh" >/dev/null -} - -TEST_MODEL="XPS 13 9340" run_leaf -[[ ! -e $display_conf && ! -s $TEST_LOG ]] || fail "other XPS models are unchanged" -TEST_PTL=0 run_leaf -[[ ! -e $display_conf && ! -s $TEST_LOG ]] || fail "DX13260 without Panther Lake is unchanged" -TEST_MODEL="ThinkPad X1" run_migration -[[ ! -e $display_conf && ! -e $rebuild_marker && ! -s $TEST_LOG ]] || fail "migration skips unrelated hardware" -pass "hardware setup and migration skip unrelated models and GPUs" - -run_leaf -declare -A KERNEL_CMDLINE=([default]="root=UUID=keep quiet") -source "$display_conf" -expected_cmdline='root=UUID=keep quiet xe.enable_psr2_sel_fetch=0 xe.enable_panel_replay=0' -[[ ${KERNEL_CMDLINE[default]} == "$expected_cmdline" ]] || fail "drop-in adds both parameters and preserves the root command line" -pass "drop-in adds both parameters and preserves the root command line" - -run_leaf -[[ ! -s $TEST_LOG ]] || fail "repeated hardware setup does not rewrite or duplicate parameters" -pass "repeated hardware setup does not rewrite or duplicate parameters" - -TEST_REBUILD_STATUS=1 run_migration && fail "a failed boot rebuild leaves the migration pending" -[[ ! -e $rebuild_marker ]] && ! grep -q '^state ' "$TEST_LOG" || - fail "a failed boot rebuild creates no completion marker or reboot state" -pass "a failed boot rebuild leaves the migration pending without recording completion" - -printf '%s\n' 'root=UUID=keep quiet' >"$TEST_IMAGE_CMDLINE" -TEST_REBUILD_ERROR=1 run_migration && fail "Limine's swallowed build error leaves the migration pending" -[[ ! -e $rebuild_marker && $(<"$TEST_IMAGE_CMDLINE") == 'root=UUID=keep quiet' ]] && - ! grep -q '^state ' "$TEST_LOG" || fail "a skipped boot image cannot record migration completion" -pass "Limine's swallowed build error leaves the migration pending with its old image" - -run_migration -[[ -e $rebuild_marker && $(<"$TEST_IMAGE_CMDLINE") == "$expected_cmdline" ]] || - fail "retry rebuilds the boot image with both parameters before recording completion" -grep -q '^state set reboot-required$' "$TEST_LOG" || fail "the migration requests a reboot" -pass "retry rebuilds the boot image with both parameters and requests a reboot" - -run_migration -[[ $(<"$TEST_LOG") == 'state set reboot-required' ]] || - fail "another user's migration skips the machine-wide rebuild and still requests reboot" -pass "another user's migration skips the machine-wide rebuild and still requests reboot" - -printf '%s\n' 'root=UUID=keep quiet xe.enable_psr2_sel_fetch=0' >"$running_cmdline" -run_migration -[[ $(<"$TEST_LOG") == 'state set reboot-required' ]] || fail "one booted parameter is insufficient" -printf '%s\n' 'root=UUID=keep quiet xe.enable_panel_replay=0' >"$running_cmdline" -run_migration -[[ $(<"$TEST_LOG") == 'state set reboot-required' ]] || fail "the other booted parameter is insufficient" -printf '%s\n' "$expected_cmdline" >"$running_cmdline" -run_migration -[[ ! -s $TEST_LOG ]] || fail "both booted parameters avoid an unnecessary reboot prompt" -pass "the reboot prompt remains until both parameters are booted" - -rm "$display_conf" -printf '%s\n' 'root=UUID=keep quiet' >"$TEST_IMAGE_CMDLINE" -printf '%s\n' 'root=UUID=keep quiet' >"$running_cmdline" -TEST_REBUILD_STATUS=1 run_migration && fail "a failed rebuild after restoring the drop-in leaves the migration pending" -[[ -e $display_conf && ! -e $rebuild_marker ]] && ! grep -q '^state ' "$TEST_LOG" || - fail "restoring the drop-in invalidates the old rebuild marker before a failed rebuild" -pass "restoring the drop-in invalidates the old marker before a failed rebuild" - -run_migration -[[ -e $rebuild_marker && $(<"$TEST_IMAGE_CMDLINE") == "$expected_cmdline" ]] && - grep -q '^sudo limine-mkinitcpio$' "$TEST_LOG" && - grep -q '^state set reboot-required$' "$TEST_LOG" || - fail "restoring a lost drop-in rebuilds even after a previous successful migration" -pass "restoring a lost drop-in rebuilds even after a previous successful migration" diff --git a/test/shell.d/xps13-ptl-firmware-retention-test.sh b/test/shell.d/xps13-ptl-firmware-retention-test.sh deleted file mode 100755 index 771d5509..00000000 --- a/test/shell.d/xps13-ptl-firmware-retention-test.sh +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/bash -set -euo pipefail - -source "$(dirname "$0")/base-test.sh" -require_command pacman -require_command pacman-conf -require_command vercmp -real_pacman=$(command -v pacman) -real_pacman_conf=$(command -v pacman-conf) -test_tmp=$(mktemp -d) -trap 'rm -rf "$test_tmp"' EXIT -mkdir -p "$test_tmp/bin" "$test_tmp/db/local" "$test_tmp/db/sync" "$test_tmp/package" -printf '9\n' >"$test_tmp/db/local/ALPM_DB_VERSION" - -export RETENTION_REAL_PACMAN="$real_pacman" RETENTION_REAL_CONF="$real_pacman_conf" -export RETENTION_ROOT="$test_tmp" RETENTION_PTL=1 -cat >"$test_tmp/bin/pacman" <<'STUB' -#!/bin/bash -query=0 -for arg in "$@"; do - [[ $arg != -Q* && $arg != -Sg* ]] || query=1 -done -if (( query )); then - if [[ ${RETENTION_SIMULATE_SUCCESS:-0} == 1 && -e $RETENTION_ROOT/transaction-success && $* == *-Q* ]]; then - printf 'linux-firmware-cirrus 20260810-3\n' - exit 0 - fi - exec "$RETENTION_REAL_PACMAN" --config "$RETENTION_ROOT/pacman.conf" --dbpath "$RETENTION_ROOT/db" "$@" -fi -printf '%s\n' "$@" >"$RETENTION_ROOT/transaction-args" -[[ ${RETENTION_FAILURE:-0} == 0 ]] || exit "$RETENTION_FAILURE" -"$RETENTION_REAL_PACMAN" --config "$RETENTION_ROOT/pacman.conf" --dbpath "$RETENTION_ROOT/db" --print --print-format '%r/%n %v' "$@" || exit $? -touch "$RETENTION_ROOT/transaction-success" -STUB -cat >"$test_tmp/bin/omarchy-state" <<'STUB' -#!/bin/bash -printf '%s\n' "$*" >>"$RETENTION_ROOT/state" -STUB -cat >"$test_tmp/bin/pacman-conf" <<'STUB' -#!/bin/bash -exec "$RETENTION_REAL_CONF" --config "$RETENTION_ROOT/pacman.conf" "$@" -STUB -cat >"$test_tmp/bin/omarchy-hw-dell-xps13-dx13260-ptl" <<'STUB' -#!/bin/bash -[[ $RETENTION_PTL == 1 ]] -STUB -cat >"$test_tmp/bin/sudo" <<'STUB' -#!/bin/bash -exec "$@" -STUB -cat >"$test_tmp/bin/systemd-run" <<'STUB' -#!/bin/bash -while [[ $1 == -* ]]; do shift; done -exec "$@" -STUB -chmod +x "$test_tmp/bin/"* - -write_repo() { - local repo="$1" version="$2" - local entry="linux-firmware-cirrus-$version" - mkdir -p "$test_tmp/package/$entry" - cat >"$test_tmp/package/$entry/desc" <"$test_tmp/db/local/linux-firmware-cirrus-$1/desc" - : >"$test_tmp/db/local/linux-firmware-cirrus-$1/files" - fi - cat >"$test_tmp/pacman.conf" <"$test_tmp/result" 2>"$test_tmp/errors" || status=$? - (( status == 0 )) || cat "$test_tmp/errors" >&2 - return "$status" -} -expect_package() { - [[ $(<"$test_tmp/result") == "$1" ]] || fail "$2" "$(<"$test_tmp/result") $(<"$test_tmp/errors")" - pass "$2" -} - -reset_fixture 20260810-3 -run_transaction -Suu --noconfirm -expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "refresh selects the shim instead of downgrading to core" -run_transaction -Suu --needed --noconfirm -expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "an installed target is retained even when --needed was supplied" -run_transaction --sync --sysupgrade --sysupgrade --noconfirm -expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "long downgrade options retain the firmware minimum" -RETENTION_PTL=0 run_transaction -Suu --needed --noconfirm -expect_package 'core/linux-firmware-cirrus 20260810-2' "other hardware retains the original downgrade behavior" - -for installed in '' 20260810-2; do - reset_fixture "$installed" - run_transaction -Su --noconfirm - expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "normal update repairs missing or downgraded firmware independently of migrations" - [[ ! -e $test_tmp/state ]] || fail "print-only transactions request no reboot" -done -reset_fixture 20260810-2 -run_transaction -Su --needed --noconfirm -expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "normal update with --needed still repairs old firmware" -for installed in 20260810-3 20260910-2 1:20260810-2; do - reset_fixture "$installed" - run_transaction -Su --noconfirm - expect_package '' "normal update preserves sufficient or newer local firmware without reinstalling" - [[ ! -e $test_tmp/state ]] || fail "unchanged firmware requests no reboot" -done -reset_fixture 20260810-3 -# --print omits IgnorePkg questions, so these cases verify the forwarded mask. -run_transaction -Suu --noconfirm --ignore 'linux-firmware-*' -expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "print resolution retains the minimum target with command-line exclusions" -[[ $(sed -n '/^--ask$/{n;p;}' "$test_tmp/transaction-args") == 1 ]] || fail "package exclusions use pacman's native question policy" -run_transaction -Suu --noconfirm --ignoregroup=firmware,other -expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "print resolution retains the minimum target with command-line group exclusions" -[[ $(sed -n '/^--ask$/{n;p;}' "$test_tmp/transaction-args") == 1 ]] || fail "group exclusions use pacman's native question policy" -reset_fixture 20260810-3 -write_repo core 20260910-2 -run_transaction -Suu --noconfirm -expect_package 'core/linux-firmware-cirrus 20260910-2' "refresh selects newer core firmware when available" - -for ignored in 'IgnorePkg = linux-firmware-*' 'IgnoreGroup = firm*'; do - for installed in 20260810-2 20260810-3; do - reset_fixture "$installed" - sed -i "/Architecture/a $ignored" "$test_tmp/pacman.conf" - run_transaction -Suu --noconfirm - expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "print resolution delegates configured exclusions to the native policy" - [[ $(sed -n '/^--ask$/{n;p;}' "$test_tmp/transaction-args") == 1 ]] || fail "configured exclusions use pacman's native question policy" - [[ ! -e $test_tmp/state ]] || fail "excluded firmware requests no reboot" - done -done -reset_fixture 20260810-3 -rm "$test_tmp/db/sync/omarchy.db" -sed -i '/\[omarchy\]/,$d' "$test_tmp/pacman.conf" -if run_transaction -Suu --noconfirm; then - fail "unavailable firmware minimum fails the transaction" -fi -[[ ! -s $test_tmp/result ]] || fail "failed resolution schedules no downgrade" -pass "unavailable firmware minimum fails without scheduling a downgrade" -reset_fixture 20260810-2 -status=0 -RETENTION_FAILURE=23 run_transaction -Su --noconfirm || status=$? -[[ $status == 23 && ! -e $test_tmp/state ]] || fail "a failed firmware repair preserves its status and requests no reboot" -pass "a failed firmware repair preserves its status and requests no reboot" - -reset_fixture 20260810-2 -RETENTION_SIMULATE_SUCCESS=1 run_transaction -Su --noconfirm -[[ $(<"$test_tmp/state") == 'set reboot-required' ]] || fail "verified installed repair requests reboot without migrations" -pass "verified installed repair requests reboot without migrations" -for installed in 20260810-2 20260810-3; do - reset_fixture "$installed" - run_transaction -Su --needed --noconfirm linux-firmware-cirrus - expected='omarchy/linux-firmware-cirrus 20260810-3' - [[ $installed != 20260810-3 ]] || expected='' - expect_package "$expected" "explicit bare targets cannot bypass the firmware minimum or create duplicates" -done -reset_fixture 20260810-3 -run_transaction -Suu --noconfirm core/linux-firmware-cirrus -expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "repo-qualified bare targets cannot bypass refresh retention" -reset_fixture '' -sed -i '/Architecture/a IgnoreGroup = firm*' "$test_tmp/pacman.conf" -run_transaction -Suu --noconfirm -expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "missing firmware delegates sync-only group exclusions to the native policy" - -reset_fixture 20260810-3 -run_transaction -Suu --noconfirm --ask 4 -[[ $(sed -n '/^--ask$/{n;p;}' "$test_tmp/transaction-args" | tail -1) == 5 ]] || fail "existing question bits are preserved" -pass "existing question bits are preserved" - -reset_fixture 20260810-3 -run_transaction -Suu --noconfirm -- linux-firmware-cirrus -expect_package 'omarchy/linux-firmware-cirrus 20260810-3' "the option separator remains valid with an explicit target" -reset_fixture 20260810-2 -run_transaction -Su --noconfirm --confirm -[[ $(<"$test_tmp/transaction-args") != *'--ask'* ]] || fail "a final --confirm keeps the interactive question policy" -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" diff --git a/test/shell.d/xps13-ptl-firmware-test.sh b/test/shell.d/xps13-ptl-firmware-test.sh index 87a523a8..2172c1fa 100755 --- a/test/shell.d/xps13-ptl-firmware-test.sh +++ b/test/shell.d/xps13-ptl-firmware-test.sh @@ -5,67 +5,16 @@ set -euo pipefail source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" leaf="$ROOT/install/hardware/dell-xps13-ptl-speaker-firmware.sh" -migration="$ROOT/migrations/1790904845.sh" +migration="$ROOT/migrations/1791265613.sh" grep -q 'run_logged .*hardware/dell-xps13-ptl-speaker-firmware.sh' "$ROOT/install/hardware/all.sh" || fail "hardware setup installs the Panther Lake XPS 13 firmware" pass "hardware setup installs the Panther Lake XPS 13 firmware" -require_command vercmp -require_command pacman -real_pacman=$(command -v pacman) test_tmp=$(mktemp -d) trap 'rm -rf "$test_tmp"' EXIT mkdir -p "$test_tmp/bin" -firmware_target=$(grep -E '^(omarchy/)?linux-firmware-cirrus' "$ROOT/install/omarchy-other.packages") -mkdir -p "$test_tmp/db/local" "$test_tmp/db/sync" "$test_tmp/package" -cat >"$test_tmp/pacman.conf" <<'CONF' -[options] -Architecture = x86_64 -SigLevel = Never -[core] -Server = https://example.invalid/core -[omarchy] -Server = https://example.invalid/omarchy -CONF - -write_repo() { - local repo="$1" version="$2" - local entry="linux-firmware-cirrus-$version" - mkdir -p "$test_tmp/package/$entry" - cat >"$test_tmp/package/$entry/desc" <"$test_tmp/bin/omarchy-hw-match" <<'SH' #!/bin/bash [[ $TEST_PRODUCT_NAME == *"$1"* ]] @@ -81,13 +30,18 @@ SH cat >"$test_tmp/bin/pacman" <<'SH' #!/bin/bash if [[ $1 == "-Q" ]]; then - [[ -s $TEST_VERSION_FILE ]] || exit 1 - printf 'linux-firmware-cirrus %s\n' "$(<"$TEST_VERSION_FILE")" + if [[ ${@: -1} == "linux-firmware-cirrus-dx13260" ]]; then + [[ -e $TEST_ALIAS_FILE ]] || exit 1 + printf 'linux-firmware-cirrus-dx13260 20260810-1\n' + else + [[ -s $TEST_VERSION_FILE ]] || exit 1 + printf 'linux-firmware-cirrus %s\n' "$(<"$TEST_VERSION_FILE")" + fi else printf 'pacman %s\n' "$*" >>"$TEST_LOG" - [[ $* == "-S --noconfirm --needed omarchy/linux-firmware-cirrus" ]] || exit 1 + [[ $* == "-S --noconfirm --needed -- linux-firmware-cirrus-dx13260" ]] || exit 1 [[ ${TEST_INSTALL_FAILURE:-0} == "0" ]] || exit 1 - printf '20260810-3\n' >"$TEST_VERSION_FILE" + touch "$TEST_ALIAS_FILE" fi SH cat >"$test_tmp/bin/omarchy-state" <<'SH' @@ -98,9 +52,9 @@ chmod +x "$test_tmp/bin/"* test_path="$PATH" export PATH="$test_tmp/bin:$ROOT/bin:$PATH" -export TEST_LOG="$test_tmp/calls" TEST_VERSION_FILE="$test_tmp/version" +export TEST_LOG="$test_tmp/calls" TEST_VERSION_FILE="$test_tmp/version" TEST_ALIAS_FILE="$test_tmp/alias-installed" export TEST_PRODUCT_NAME="XPS 13 DX13260" TEST_INTEL_PTL=1 -install_call="pacman -S --noconfirm --needed omarchy/linux-firmware-cirrus" +install_call="pacman -S --noconfirm --needed -- linux-firmware-cirrus-dx13260" firmware_pending="$test_tmp/run/pending" # Redirect the fixed filesystem path in isolated copies, not through production environment overrides. @@ -116,7 +70,7 @@ migration="$OMARCHY_PATH/migrations/${migration##*/}" reset_fixture() { : >"$TEST_LOG" printf '%s' "$1" >"$TEST_VERSION_FILE" - rm -f "$firmware_pending" + rm -f "$firmware_pending" "$TEST_ALIAS_FILE" } run_leaf() { @@ -139,23 +93,21 @@ TEST_INTEL_PTL=0 run_migration [[ ! -s $TEST_LOG && ! -e $firmware_pending ]] || fail "the Wildcat Lake variant receives no firmware repair" pass "other models and the Wildcat Lake variant receive no firmware repair" -for version in "" "20260810-2"; do +for version in "" "20260810-2" "20260810-3" "20260810-4" "20260910-2" "20260916-1" "1:20260810-2"; do reset_fixture "$version" - run_leaf || fail "missing or old firmware is installed during hardware setup" - [[ $(<"$TEST_LOG") == "$install_call" && $(<"$TEST_VERSION_FILE") == "20260810-3" ]] || - fail "hardware setup explicitly selects the Omarchy firmware" + run_leaf || fail "the alias package is installed during hardware setup" + [[ $(<"$TEST_LOG") == "$install_call" && $(<"$TEST_VERSION_FILE") == "$version" && -e $TEST_ALIAS_FILE ]] || + fail "hardware setup installs the separate aliases without replacing stock firmware" [[ -e $firmware_pending ]] || fail "the firmware repair records its pending reboot" done -pass "hardware setup explicitly installs the Omarchy firmware when missing or old" +pass "hardware setup installs the package identity without replacing any stock firmware" -for version in "20260810-3" "20260810-4" "20260910-2" "1:20260810-2"; do - reset_fixture "$version" - run_leaf - run_migration - [[ ! -s $TEST_LOG && ! -e $firmware_pending && $(<"$TEST_VERSION_FILE") == "$version" ]] || - fail "sufficient or newer firmware is preserved without a reboot request" -done -pass "sufficient or newer firmware is preserved without a reboot request" +reset_fixture "20260810-2" +touch "$TEST_ALIAS_FILE" +run_leaf +run_migration +[[ ! -s $TEST_LOG && ! -e $firmware_pending ]] || fail "installed aliases are idempotent on stock firmware" +pass "installed aliases are idempotent on stock firmware" reset_fixture "20260810-2" if TEST_INSTALL_FAILURE=1 run_migration; then