From 45d2e807db5c4c4bde14d1c0b28e8cc3e57d5c68 Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Thu, 1 Oct 2026 23:00:51 -0500 Subject: [PATCH 01/11] Install the Dell XPS 13 Panther Lake speaker firmware Explicitly select the Omarchy Cirrus firmware when the installed package predates the 1028:0e54 aliases. Apply it during hardware setup and through an update migration, and request a reboot for each user until the firmware can load. Require the same minimum version in the offline package list so newer Arch snapshots keep their genuine firmware. Co-Authored-By: GPT-6.1-Sol --- bin/omarchy-hw-dell-xps13-dx13260-ptl | 5 + install/hardware/all.sh | 1 + .../dell-xps13-ptl-speaker-firmware.sh | 12 ++ install/omarchy-other.packages | 2 + migrations/1790904845.sh | 11 ++ test/shell.d/xps13-ptl-firmware-test.sh | 181 ++++++++++++++++++ 6 files changed, 212 insertions(+) create mode 100755 bin/omarchy-hw-dell-xps13-dx13260-ptl create mode 100644 install/hardware/dell-xps13-ptl-speaker-firmware.sh create mode 100644 migrations/1790904845.sh create mode 100755 test/shell.d/xps13-ptl-firmware-test.sh diff --git a/bin/omarchy-hw-dell-xps13-dx13260-ptl b/bin/omarchy-hw-dell-xps13-dx13260-ptl new file mode 100755 index 00000000..18c063b0 --- /dev/null +++ b/bin/omarchy-hw-dell-xps13-dx13260-ptl @@ -0,0 +1,5 @@ +#!/bin/bash + +# omarchy:summary=Match the Dell XPS 13 DX13260 with an Intel Panther Lake GPU. + +omarchy-hw-match "DX13260" && omarchy-hw-intel-ptl diff --git a/install/hardware/all.sh b/install/hardware/all.sh index 12add110..92f3fdea 100644 --- a/install/hardware/all.sh +++ b/install/hardware/all.sh @@ -18,6 +18,7 @@ run_logged "$OMARCHY_INSTALL/hardware/intel/ipu7-camera.sh" 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/fix-elgato-camlink-4k.sh" diff --git a/install/hardware/dell-xps13-ptl-speaker-firmware.sh b/install/hardware/dell-xps13-ptl-speaker-firmware.sh new file mode 100644 index 00000000..f36bceab --- /dev/null +++ b/install/hardware/dell-xps13-ptl-speaker-firmware.sh @@ -0,0 +1,12 @@ +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 + firmware_pending="${OMARCHY_XPS13_FIRMWARE_PENDING:-/run/omarchy/xps13-ptl-speaker-firmware}" + sudo install -Dm644 /dev/null "$firmware_pending" + + # [core] precedes [omarchy], so an unqualified target selects the older firmware. + sudo pacman -S --noconfirm --needed omarchy/linux-firmware-cirrus + fi +fi diff --git a/install/omarchy-other.packages b/install/omarchy-other.packages index ee7607a7..65abbbe2 100644 --- a/install/omarchy-other.packages +++ b/install/omarchy-other.packages @@ -59,6 +59,8 @@ 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 # Speaker tunings (LV2 limiter every tuning ends in) lsp-plugins-lv2 diff --git a/migrations/1790904845.sh b/migrations/1790904845.sh new file mode 100644 index 00000000..0f376be3 --- /dev/null +++ b/migrations/1790904845.sh @@ -0,0 +1,11 @@ +echo "Install the Dell XPS 13 Panther Lake speaker firmware" + +if omarchy-hw-dell-xps13-dx13260-ptl; then + source "$OMARCHY_PATH/install/hardware/dell-xps13-ptl-speaker-firmware.sh" + + # The marker lasts until reboot so every user migrating beforehand is prompted. + firmware_pending="${OMARCHY_XPS13_FIRMWARE_PENDING:-/run/omarchy/xps13-ptl-speaker-firmware}" + if [[ -e $firmware_pending ]]; then + omarchy-state set reboot-required + fi +fi diff --git a/test/shell.d/xps13-ptl-firmware-test.sh b/test/shell.d/xps13-ptl-firmware-test.sh new file mode 100755 index 00000000..3d754160 --- /dev/null +++ b/test/shell.d/xps13-ptl-firmware-test.sh @@ -0,0 +1,181 @@ +#!/bin/bash + +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" + +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"* ]] +SH +cat >"$test_tmp/bin/omarchy-hw-intel-ptl" <<'SH' +#!/bin/bash +[[ $TEST_INTEL_PTL == "1" ]] +SH +cat >"$test_tmp/bin/sudo" <<'SH' +#!/bin/bash +exec "$@" +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")" +else + printf 'pacman %s\n' "$*" >>"$TEST_LOG" + [[ $* == "-S --noconfirm --needed omarchy/linux-firmware-cirrus" ]] || exit 1 + [[ ${TEST_INSTALL_FAILURE:-0} == "0" ]] || exit 1 + printf '20260810-3\n' >"$TEST_VERSION_FILE" +fi +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 OMARCHY_PATH="$ROOT" TEST_LOG="$test_tmp/calls" TEST_VERSION_FILE="$test_tmp/version" +export OMARCHY_XPS13_FIRMWARE_PENDING="$test_tmp/run/pending" +export TEST_PRODUCT_NAME="XPS 13 DX13260" TEST_INTEL_PTL=1 +install_call="pacman -S --noconfirm --needed omarchy/linux-firmware-cirrus" + +reset_fixture() { + : >"$TEST_LOG" + printf '%s' "$1" >"$TEST_VERSION_FILE" + rm -f "$OMARCHY_XPS13_FIRMWARE_PENDING" +} + +run_leaf() { + bash -eE -c 'source "$1"' bash "$leaf" +} + +run_migration() { + bash -euo pipefail "$migration" >/dev/null +} + +for model in "XPS 9350" "XPS 13 DX13261"; do + reset_fixture "20260810-2" + TEST_PRODUCT_NAME="$model" run_leaf + TEST_PRODUCT_NAME="$model" run_migration + [[ ! -s $TEST_LOG && ! -e $OMARCHY_XPS13_FIRMWARE_PENDING ]] || fail "other models receive no firmware repair" +done +reset_fixture "20260810-2" +TEST_INTEL_PTL=0 run_leaf +TEST_INTEL_PTL=0 run_migration +[[ ! -s $TEST_LOG && ! -e $OMARCHY_XPS13_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 + 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" + [[ -e $OMARCHY_XPS13_FIRMWARE_PENDING ]] || fail "the firmware repair records its pending reboot" +done +pass "hardware setup explicitly installs the Omarchy firmware when missing or old" + +for version in "20260810-3" "20260810-4" "20260910-2" "1:20260810-2"; do + reset_fixture "$version" + run_leaf + run_migration + [[ ! -s $TEST_LOG && ! -e $OMARCHY_XPS13_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" +if TEST_INSTALL_FAILURE=1 run_migration; then + fail "a failed firmware installation fails the migration" +fi +[[ $(<"$TEST_LOG") == "$install_call" && $(<"$TEST_VERSION_FILE") == "20260810-2" ]] || + fail "a failed installation leaves the migration retryable without claiming success" +pass "a failed firmware installation fails the migration and remains retryable" + +: >"$TEST_LOG" +run_migration +[[ $(<"$TEST_LOG") == "$install_call"$'\nstate set reboot-required' ]] || + fail "retrying the migration installs the firmware and requests a reboot" +pass "retrying the migration installs the firmware and requests a reboot" + +: >"$TEST_LOG" +run_migration +[[ $(<"$TEST_LOG") == "state set reboot-required" ]] || + fail "a second user before reboot is prompted without reinstalling" +pass "a second user before reboot is prompted without reinstalling" + +: >"$TEST_LOG" +rm -f "$OMARCHY_XPS13_FIRMWARE_PENDING" +run_migration +[[ ! -s $TEST_LOG ]] || fail "the migration is a no-op after reboot with repaired firmware" +pass "the migration is a no-op after reboot with repaired firmware" + +reset_fixture "20260810-2" +if OMARCHY_XPS13_FIRMWARE_PENDING="$TEST_VERSION_FILE/not-a-directory" run_migration 2>/dev/null; then + fail "failure to record the pending reboot fails the migration" +fi +[[ ! -s $TEST_LOG && $(<"$TEST_VERSION_FILE") == "20260810-2" ]] || + fail "failure to record the reboot marker installs nothing" +pass "failure to record the reboot marker installs nothing" From 89fcd6a1b78ae699965121c9a1b56eea14f0133f Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Thu, 1 Oct 2026 23:09:06 -0500 Subject: [PATCH 02/11] Keep the firmware reboot marker destination fixed A caller-controlled marker path would let the privileged install command replace an unrelated file. Keep the production path fixed and redirect that literal only in isolated test copies. Cover hostile environment overrides without touching system files. Co-Authored-By: GPT-6.1-Sol Co-Authored-By: Greptile <165735046+greptile-apps[bot]@users.noreply.github.com> --- .../dell-xps13-ptl-speaker-firmware.sh | 2 +- migrations/1790904845.sh | 2 +- test/shell.d/xps13-ptl-firmware-test.sh | 37 ++++++++++++++----- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/install/hardware/dell-xps13-ptl-speaker-firmware.sh b/install/hardware/dell-xps13-ptl-speaker-firmware.sh index f36bceab..e66d57fc 100644 --- a/install/hardware/dell-xps13-ptl-speaker-firmware.sh +++ b/install/hardware/dell-xps13-ptl-speaker-firmware.sh @@ -3,7 +3,7 @@ if omarchy-hw-dell-xps13-dx13260-ptl; then # Keep newer Arch firmware when stable's snapshot supersedes the shim. if [[ -z $cirrus_package ]] || (( $(vercmp "${cirrus_package#* }" "20260810-3") < 0 )); then - firmware_pending="${OMARCHY_XPS13_FIRMWARE_PENDING:-/run/omarchy/xps13-ptl-speaker-firmware}" + firmware_pending="/run/omarchy/xps13-ptl-speaker-firmware" sudo install -Dm644 /dev/null "$firmware_pending" # [core] precedes [omarchy], so an unqualified target selects the older firmware. diff --git a/migrations/1790904845.sh b/migrations/1790904845.sh index 0f376be3..14c251d8 100644 --- a/migrations/1790904845.sh +++ b/migrations/1790904845.sh @@ -4,7 +4,7 @@ if omarchy-hw-dell-xps13-dx13260-ptl; then source "$OMARCHY_PATH/install/hardware/dell-xps13-ptl-speaker-firmware.sh" # The marker lasts until reboot so every user migrating beforehand is prompted. - firmware_pending="${OMARCHY_XPS13_FIRMWARE_PENDING:-/run/omarchy/xps13-ptl-speaker-firmware}" + firmware_pending="/run/omarchy/xps13-ptl-speaker-firmware" if [[ -e $firmware_pending ]]; then omarchy-state set reboot-required fi diff --git a/test/shell.d/xps13-ptl-firmware-test.sh b/test/shell.d/xps13-ptl-firmware-test.sh index 3d754160..281415d9 100755 --- a/test/shell.d/xps13-ptl-firmware-test.sh +++ b/test/shell.d/xps13-ptl-firmware-test.sh @@ -97,15 +97,23 @@ SH chmod +x "$test_tmp/bin/"* export PATH="$test_tmp/bin:$ROOT/bin:$PATH" -export OMARCHY_PATH="$ROOT" TEST_LOG="$test_tmp/calls" TEST_VERSION_FILE="$test_tmp/version" -export OMARCHY_XPS13_FIRMWARE_PENDING="$test_tmp/run/pending" +export TEST_LOG="$test_tmp/calls" TEST_VERSION_FILE="$test_tmp/version" export TEST_PRODUCT_NAME="XPS 13 DX13260" TEST_INTEL_PTL=1 install_call="pacman -S --noconfirm --needed omarchy/linux-firmware-cirrus" +firmware_pending="$test_tmp/run/pending" + +# Redirect the fixed filesystem path in isolated copies, not through production environment overrides. +export OMARCHY_PATH="$test_tmp/omarchy" +mkdir -p "$OMARCHY_PATH/install/hardware" "$OMARCHY_PATH/migrations" +sed "s|/run/omarchy/xps13-ptl-speaker-firmware|$firmware_pending|g" "$leaf" >"$OMARCHY_PATH/install/hardware/${leaf##*/}" +sed "s|/run/omarchy/xps13-ptl-speaker-firmware|$firmware_pending|g" "$migration" >"$OMARCHY_PATH/migrations/${migration##*/}" +leaf="$OMARCHY_PATH/install/hardware/${leaf##*/}" +migration="$OMARCHY_PATH/migrations/${migration##*/}" reset_fixture() { : >"$TEST_LOG" printf '%s' "$1" >"$TEST_VERSION_FILE" - rm -f "$OMARCHY_XPS13_FIRMWARE_PENDING" + rm -f "$firmware_pending" } run_leaf() { @@ -120,12 +128,12 @@ for model in "XPS 9350" "XPS 13 DX13261"; do reset_fixture "20260810-2" TEST_PRODUCT_NAME="$model" run_leaf TEST_PRODUCT_NAME="$model" run_migration - [[ ! -s $TEST_LOG && ! -e $OMARCHY_XPS13_FIRMWARE_PENDING ]] || fail "other models receive no firmware repair" + [[ ! -s $TEST_LOG && ! -e $firmware_pending ]] || fail "other models receive no firmware repair" done reset_fixture "20260810-2" TEST_INTEL_PTL=0 run_leaf TEST_INTEL_PTL=0 run_migration -[[ ! -s $TEST_LOG && ! -e $OMARCHY_XPS13_FIRMWARE_PENDING ]] || fail "the Wildcat Lake variant receives no firmware repair" +[[ ! -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 @@ -133,7 +141,7 @@ for version in "" "20260810-2"; do 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" - [[ -e $OMARCHY_XPS13_FIRMWARE_PENDING ]] || fail "the firmware repair records its pending reboot" + [[ -e $firmware_pending ]] || fail "the firmware repair records its pending reboot" done pass "hardware setup explicitly installs the Omarchy firmware when missing or old" @@ -141,7 +149,7 @@ for version in "20260810-3" "20260810-4" "20260910-2" "1:20260810-2"; do reset_fixture "$version" run_leaf run_migration - [[ ! -s $TEST_LOG && ! -e $OMARCHY_XPS13_FIRMWARE_PENDING && $(<"$TEST_VERSION_FILE") == "$version" ]] || + [[ ! -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" @@ -167,15 +175,26 @@ run_migration pass "a second user before reboot is prompted without reinstalling" : >"$TEST_LOG" -rm -f "$OMARCHY_XPS13_FIRMWARE_PENDING" +rm -f "$firmware_pending" run_migration [[ ! -s $TEST_LOG ]] || fail "the migration is a no-op after reboot with repaired firmware" pass "the migration is a no-op after reboot with repaired firmware" reset_fixture "20260810-2" -if OMARCHY_XPS13_FIRMWARE_PENDING="$TEST_VERSION_FILE/not-a-directory" run_migration 2>/dev/null; then +rm -rf "$test_tmp/run" +touch "$test_tmp/run" +if run_migration 2>/dev/null; then fail "failure to record the pending reboot fails the migration" fi [[ ! -s $TEST_LOG && $(<"$TEST_VERSION_FILE") == "20260810-2" ]] || fail "failure to record the reboot marker installs nothing" pass "failure to record the reboot marker installs nothing" + +rm -f "$test_tmp/run" +reset_fixture "20260810-2" +protected_file="$test_tmp/protected" +printf 'preserve me\n' >"$protected_file" +OMARCHY_XPS13_FIRMWARE_PENDING="$protected_file" run_migration +[[ $(<"$protected_file") == "preserve me" && -e $firmware_pending && $(<"$TEST_LOG") == "$install_call"$'\nstate set reboot-required' ]] || + fail "the invoking user's environment cannot redirect the privileged marker write" +pass "the invoking user's environment cannot redirect the privileged marker write" From 8be14d5ac67a7a1a6928a40b5d8197b19683acfb Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Thu, 1 Oct 2026 23:41:22 -0500 Subject: [PATCH 03/11] Explain why the Cirrus firmware repair uses pacman directly Co-Authored-By: GPT-6.1-Sol --- install/hardware/dell-xps13-ptl-speaker-firmware.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/hardware/dell-xps13-ptl-speaker-firmware.sh b/install/hardware/dell-xps13-ptl-speaker-firmware.sh index e66d57fc..bd04e746 100644 --- a/install/hardware/dell-xps13-ptl-speaker-firmware.sh +++ b/install/hardware/dell-xps13-ptl-speaker-firmware.sh @@ -6,7 +6,8 @@ if omarchy-hw-dell-xps13-dx13260-ptl; then firmware_pending="/run/omarchy/xps13-ptl-speaker-firmware" sudo install -Dm644 /dev/null "$firmware_pending" - # [core] precedes [omarchy], so an unqualified target selects the older firmware. + # 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 fi From 96af8d4c0269b534ce0cdfdc70a555204823b3cf Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Thu, 1 Oct 2026 23:46:32 -0500 Subject: [PATCH 04/11] Escape firmware test fixture paths Quote the marker path as a Bash literal before escaping it for sed, so TMPDIR metacharacters survive both fixture copying and script evaluation. Rerun the firmware regression under a special-character TMPDIR while preserving the original PATH for real pacman resolution. Co-Authored-By: GPT-6.1-Sol Co-Authored-By: Greptile <165735046+greptile-apps[bot]@users.noreply.github.com> --- test/shell.d/xps13-ptl-firmware-test.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/shell.d/xps13-ptl-firmware-test.sh b/test/shell.d/xps13-ptl-firmware-test.sh index 281415d9..87a523a8 100755 --- a/test/shell.d/xps13-ptl-firmware-test.sh +++ b/test/shell.d/xps13-ptl-firmware-test.sh @@ -96,6 +96,7 @@ printf 'state %s\n' "$*" >>"$TEST_LOG" SH 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_PRODUCT_NAME="XPS 13 DX13260" TEST_INTEL_PTL=1 @@ -105,8 +106,10 @@ firmware_pending="$test_tmp/run/pending" # Redirect the fixed filesystem path in isolated copies, not through production environment overrides. export OMARCHY_PATH="$test_tmp/omarchy" mkdir -p "$OMARCHY_PATH/install/hardware" "$OMARCHY_PATH/migrations" -sed "s|/run/omarchy/xps13-ptl-speaker-firmware|$firmware_pending|g" "$leaf" >"$OMARCHY_PATH/install/hardware/${leaf##*/}" -sed "s|/run/omarchy/xps13-ptl-speaker-firmware|$firmware_pending|g" "$migration" >"$OMARCHY_PATH/migrations/${migration##*/}" +printf -v marker_literal '%q' "$firmware_pending" +marker_replacement=$(printf '%s' "$marker_literal" | sed 's/[\\&|]/\\&/g') +sed "s|\"/run/omarchy/xps13-ptl-speaker-firmware\"|$marker_replacement|g" "$leaf" >"$OMARCHY_PATH/install/hardware/${leaf##*/}" +sed "s|\"/run/omarchy/xps13-ptl-speaker-firmware\"|$marker_replacement|g" "$migration" >"$OMARCHY_PATH/migrations/${migration##*/}" leaf="$OMARCHY_PATH/install/hardware/${leaf##*/}" migration="$OMARCHY_PATH/migrations/${migration##*/}" @@ -198,3 +201,12 @@ OMARCHY_XPS13_FIRMWARE_PENDING="$protected_file" run_migration [[ $(<"$protected_file") == "preserve me" && -e $firmware_pending && $(<"$TEST_LOG") == "$install_call"$'\nstate set reboot-required' ]] || fail "the invoking user's environment cannot redirect the privileged marker write" pass "the invoking user's environment cannot redirect the privileged marker write" + +if [[ ${TEST_FIRMWARE_SPECIAL_TMPDIR:-0} != "1" ]]; then + special_tmpdir="$test_tmp/"'tmp &|"\$fixture' + mkdir -p "$special_tmpdir" + PATH="$test_path" TMPDIR="$special_tmpdir" TEST_FIRMWARE_SPECIAL_TMPDIR=1 \ + bash "$ROOT/test/shell.d/xps13-ptl-firmware-test.sh" >"$test_tmp/special-path.log" 2>&1 || + fail "firmware fixtures work with shell and sed metacharacters in TMPDIR" "$(<"$test_tmp/special-path.log")" + pass "firmware fixtures work with shell and sed metacharacters in TMPDIR" +fi From 8f7dd71fdaa244f301ad2ce212e6813ec0c83454 Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Sat, 3 Oct 2026 16:59:33 -0500 Subject: [PATCH 05/11] Apply XPS 13 Panther Lake display parameters Disable PSR2 selective fetch and Panel Replay on DX13260 Panther Lake through a Limine drop-in. Apply it during hardware setup and an update migration, rebuild once per machine, and request reboot until both parameters are booted. Reject diagnosed Limine build errors even when the wrapper returns success so interrupted repairs stay pending. Co-Authored-By: GPT-6.1-Sol XHigh --- install/hardware/all.sh | 1 + install/hardware/dell-xps13-ptl-display.sh | 10 ++ migrations/1790916392.sh | 27 +++++ test/shell.d/xps13-ptl-display-test.sh | 127 +++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 install/hardware/dell-xps13-ptl-display.sh create mode 100644 migrations/1790916392.sh create mode 100755 test/shell.d/xps13-ptl-display-test.sh diff --git a/install/hardware/all.sh b/install/hardware/all.sh index 92f3fdea..4394cc09 100644 --- a/install/hardware/all.sh +++ b/install/hardware/all.sh @@ -19,6 +19,7 @@ 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 new file mode 100644 index 00000000..1d66b4bd --- /dev/null +++ b/install/hardware/dell-xps13-ptl-display.sh @@ -0,0 +1,10 @@ +if omarchy-hw-dell-xps13-dx13260-ptl; then + display_conf="/etc/limine-entry-tool.d/dell-xps13-ptl-display.conf" + 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 + 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/migrations/1790916392.sh b/migrations/1790916392.sh new file mode 100644 index 00000000..cd201a9b --- /dev/null +++ b/migrations/1790916392.sh @@ -0,0 +1,27 @@ +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" + + display_rebuild_marker="/var/lib/omarchy/migrations/1790916392" + + # 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/test/shell.d/xps13-ptl-display-test.sh b/test/shell.d/xps13-ptl-display-test.sh new file mode 100755 index 00000000..f02d9c00 --- /dev/null +++ b/test/shell.d/xps13-ptl-display-test.sh @@ -0,0 +1,127 @@ +#!/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 '/etc/limine-entry-tool.d$' "$test_tmp/limine" >"$OMARCHY_PATH/install/hardware/${leaf##*/}" +redirect_path '"/var/lib/omarchy/migrations/1790916392"' "$rebuild_marker" <"$migration" | + redirect_path '/proc/cmdline' "$running_cmdline" >"$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" From 81df05533c55a4e41b0b66afd8fc139f3c11f388 Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Sat, 3 Oct 2026 17:09:14 -0500 Subject: [PATCH 06/11] Invalidate the display rebuild marker before repairing its drop-in A pending migration must rebuild after restoring its missing display configuration even when another user previously completed the machine-wide rebuild. Remove the fixed marker before writing the drop-in so failed writes and builds remain retryable. Fresh installation already rebuilds after hardware setup through the ISO finalizer. Co-Authored-By: GPT-6.1-Sol XHigh Co-Authored-By: Greptile <165735046+greptile-apps[bot]@users.noreply.github.com> --- install/hardware/dell-xps13-ptl-display.sh | 3 +++ migrations/1790916392.sh | 2 -- test/shell.d/xps13-ptl-display-test.sh | 19 +++++++++++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/install/hardware/dell-xps13-ptl-display.sh b/install/hardware/dell-xps13-ptl-display.sh index 1d66b4bd..8affe0c5 100644 --- a/install/hardware/dell-xps13-ptl-display.sh +++ b/install/hardware/dell-xps13-ptl-display.sh @@ -1,8 +1,11 @@ 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 diff --git a/migrations/1790916392.sh b/migrations/1790916392.sh index cd201a9b..eb11d98c 100644 --- a/migrations/1790916392.sh +++ b/migrations/1790916392.sh @@ -3,8 +3,6 @@ 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" - display_rebuild_marker="/var/lib/omarchy/migrations/1790916392" - # 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 diff --git a/test/shell.d/xps13-ptl-display-test.sh b/test/shell.d/xps13-ptl-display-test.sh index f02d9c00..7d96deae 100755 --- a/test/shell.d/xps13-ptl-display-test.sh +++ b/test/shell.d/xps13-ptl-display-test.sh @@ -27,9 +27,9 @@ 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 '"/var/lib/omarchy/migrations/1790916392"' "$rebuild_marker" <"$migration" | - redirect_path '/proc/cmdline' "$running_cmdline" >"$test_tmp/migration.sh" +redirect_path '/proc/cmdline' "$running_cmdline" <"$migration" >"$test_tmp/migration.sh" cat >"$test_tmp/bin/omarchy-hw-match" <<'SH' #!/bin/bash @@ -125,3 +125,18 @@ 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" From 033b5ecd3de1a64f464c1fd3d9c716258e9451b6 Mon Sep 17 00:00:00 2001 From: Spencer Bull <7035687+spencerbull@users.noreply.github.com> Date: Tue, 6 Oct 2026 00:30:29 -0500 Subject: [PATCH 07/11] Retain XPS 13 Panther Lake firmware during package refresh Constrain Cirrus firmware in the package transaction so a stable channel refresh cannot remove the required aliases. Recover old firmware independently of completed migrations, and request reboot only after verifying a successful repair. Preserve package exclusions through native pacman handling while keeping interactive conflict recovery answerable. Co-Authored-By: GPT-6.1-Sol High Co-Authored-By: GPT-6.1-Sol XHigh --- bin/omarchy-update-pacman | 99 ++++++++- 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 + .../xps13-ptl-firmware-retention-test.sh | 206 ++++++++++++++++++ 5 files changed, 331 insertions(+), 1 deletion(-) create mode 100755 test/shell.d/xps13-ptl-firmware-retention-test.sh diff --git a/bin/omarchy-update-pacman b/bin/omarchy-update-pacman index 66f66731..c9273f3c 100755 --- a/bin/omarchy-update-pacman +++ b/bin/omarchy-update-pacman @@ -5,6 +5,93 @@ # 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 +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 ;; + --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 + 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 @@ -22,4 +109,14 @@ if [[ -n ${LC_ALL:-} ]]; then env_args+=(LC_ALL="$LC_ALL") fi -exec sudo env "${env_args[@]}" "${scope[@]}" pacman "$@" +if (( repair_reboot )); then + sudo env "${env_args[@]}" "${scope[@]}" pacman "${pacman_args[@]}" || exit $? + 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 + fi +else + exec sudo env "${env_args[@]}" "${scope[@]}" pacman "${pacman_args[@]}" +fi diff --git a/test/shell.d/fixtures/sudo-boundary-test.sh b/test/shell.d/fixtures/sudo-boundary-test.sh index 1fb123d0..544d2482 100644 --- a/test/shell.d/fixtures/sudo-boundary-test.sh +++ b/test/shell.d/fixtures/sudo-boundary-test.sh @@ -32,6 +32,8 @@ 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 e05e8f7b..2f0d7053 100755 --- a/test/shell.d/update-package-conflict-test.sh +++ b/test/shell.d/update-package-conflict-test.sh @@ -31,6 +31,12 @@ 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" { @@ -47,7 +53,16 @@ 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: @@ -161,3 +176,11 @@ 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 8af6766c..9f2b088c 100755 --- a/test/shell.d/update-pacman-test.sh +++ b/test/shell.d/update-pacman-test.sh @@ -15,6 +15,8 @@ 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-firmware-retention-test.sh b/test/shell.d/xps13-ptl-firmware-retention-test.sh new file mode 100755 index 00000000..418276eb --- /dev/null +++ b/test/shell.d/xps13-ptl-firmware-retention-test.sh @@ -0,0 +1,206 @@ +#!/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" From 19e59410750e6421b9e3ec3cb88f645a554afbe0 Mon Sep 17 00:00:00 2001 From: Spencer Bull <7035687+spencerbull@users.noreply.github.com> Date: Tue, 6 Oct 2026 00:46:53 -0500 Subject: [PATCH 08/11] Fail updates that leave required Panther Lake firmware unrepaired Honor package exclusions while returning failure when an installation leaves the required Cirrus firmware too old. Print-only and download-only operations remain successful without a repair or reboot request. Co-Authored-By: GPT-6.1-Sol High Co-Authored-By: Greptile <165735046+greptile-apps[bot]@users.noreply.github.com> --- bin/omarchy-update-pacman | 9 ++++++++- .../xps13-ptl-firmware-retention-test.sh | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) 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" From 0d8232b9db162fe7d9db774ea8e2cebc62051ecd Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Tue, 6 Oct 2026 21:29:54 -0500 Subject: [PATCH 09/11] 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 From 499f50ffd649091afaf7912fa2fe729a0bd28756 Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Tue, 6 Oct 2026 21:47:56 -0500 Subject: [PATCH 10/11] Move speaker reboot bookkeeping into the migration Keep hardware setup limited to installing the firmware package. The migration owns the pending-reboot marker and preserves prompts for every user migrating before reboot. --- install/hardware/dell-xps13-ptl-speaker-firmware.sh | 4 ---- migrations/1791265613.sh | 6 +++++- test/shell.d/xps13-ptl-firmware-test.sh | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/install/hardware/dell-xps13-ptl-speaker-firmware.sh b/install/hardware/dell-xps13-ptl-speaker-firmware.sh index df9db731..fe698773 100644 --- a/install/hardware/dell-xps13-ptl-speaker-firmware.sh +++ b/install/hardware/dell-xps13-ptl-speaker-firmware.sh @@ -1,7 +1,3 @@ if omarchy-hw-dell-xps13-dx13260-ptl; 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" - fi omarchy-pkg-add linux-firmware-cirrus-dx13260 fi diff --git a/migrations/1791265613.sh b/migrations/1791265613.sh index 14c251d8..6b7a3084 100644 --- a/migrations/1791265613.sh +++ b/migrations/1791265613.sh @@ -1,10 +1,14 @@ echo "Install the Dell XPS 13 Panther Lake speaker firmware" if omarchy-hw-dell-xps13-dx13260-ptl; then + firmware_pending="/run/omarchy/xps13-ptl-speaker-firmware" + if omarchy-pkg-missing linux-firmware-cirrus-dx13260; then + sudo install -Dm644 /dev/null "$firmware_pending" + fi + source "$OMARCHY_PATH/install/hardware/dell-xps13-ptl-speaker-firmware.sh" # The marker lasts until reboot so every user migrating beforehand is prompted. - firmware_pending="/run/omarchy/xps13-ptl-speaker-firmware" if [[ -e $firmware_pending ]]; then omarchy-state set reboot-required fi diff --git a/test/shell.d/xps13-ptl-firmware-test.sh b/test/shell.d/xps13-ptl-firmware-test.sh index 2172c1fa..da403d9b 100755 --- a/test/shell.d/xps13-ptl-firmware-test.sh +++ b/test/shell.d/xps13-ptl-firmware-test.sh @@ -98,9 +98,10 @@ for version in "" "20260810-2" "20260810-3" "20260810-4" "20260910-2" "20260916- 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" + [[ ! -e $firmware_pending ]] || fail "hardware setup leaves reboot bookkeeping to the migration" done pass "hardware setup installs the package identity without replacing any stock firmware" +pass "hardware setup leaves reboot bookkeeping to the migration" reset_fixture "20260810-2" touch "$TEST_ALIAS_FILE" From db21abdef00de03dcee54fd7222b2ab3205c300e Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Tue, 6 Oct 2026 21:56:49 -0500 Subject: [PATCH 11/11] Request a reboot directly in the PTL firmware migration Each pending user's one-time migration requests a reboot even when hardware setup has already installed the aliases. Let migration completion handle repeat runs and remove the shared marker and its privileged write. Co-Authored-By: Greptile <165735046+greptile-apps[bot]@users.noreply.github.com> --- migrations/1791265613.sh | 11 +--- test/shell.d/xps13-ptl-firmware-test.sh | 68 ++++++------------------- 2 files changed, 16 insertions(+), 63 deletions(-) diff --git a/migrations/1791265613.sh b/migrations/1791265613.sh index 6b7a3084..371da510 100644 --- a/migrations/1791265613.sh +++ b/migrations/1791265613.sh @@ -1,15 +1,6 @@ echo "Install the Dell XPS 13 Panther Lake speaker firmware" if omarchy-hw-dell-xps13-dx13260-ptl; then - firmware_pending="/run/omarchy/xps13-ptl-speaker-firmware" - if omarchy-pkg-missing linux-firmware-cirrus-dx13260; then - sudo install -Dm644 /dev/null "$firmware_pending" - fi - source "$OMARCHY_PATH/install/hardware/dell-xps13-ptl-speaker-firmware.sh" - - # The marker lasts until reboot so every user migrating beforehand is prompted. - if [[ -e $firmware_pending ]]; then - omarchy-state set reboot-required - fi + omarchy-state set reboot-required fi diff --git a/test/shell.d/xps13-ptl-firmware-test.sh b/test/shell.d/xps13-ptl-firmware-test.sh index da403d9b..16cd8f46 100755 --- a/test/shell.d/xps13-ptl-firmware-test.sh +++ b/test/shell.d/xps13-ptl-firmware-test.sh @@ -25,7 +25,11 @@ cat >"$test_tmp/bin/omarchy-hw-intel-ptl" <<'SH' SH cat >"$test_tmp/bin/sudo" <<'SH' #!/bin/bash -exec "$@" +if [[ $1 == "pacman" ]]; then + exec "$@" +fi +printf 'Unexpected privileged command: %s\n' "$*" >&2 +exit 1 SH cat >"$test_tmp/bin/pacman" <<'SH' #!/bin/bash @@ -50,27 +54,16 @@ printf 'state %s\n' "$*" >>"$TEST_LOG" SH 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" TEST_ALIAS_FILE="$test_tmp/alias-installed" export TEST_PRODUCT_NAME="XPS 13 DX13260" TEST_INTEL_PTL=1 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. -export OMARCHY_PATH="$test_tmp/omarchy" -mkdir -p "$OMARCHY_PATH/install/hardware" "$OMARCHY_PATH/migrations" -printf -v marker_literal '%q' "$firmware_pending" -marker_replacement=$(printf '%s' "$marker_literal" | sed 's/[\\&|]/\\&/g') -sed "s|\"/run/omarchy/xps13-ptl-speaker-firmware\"|$marker_replacement|g" "$leaf" >"$OMARCHY_PATH/install/hardware/${leaf##*/}" -sed "s|\"/run/omarchy/xps13-ptl-speaker-firmware\"|$marker_replacement|g" "$migration" >"$OMARCHY_PATH/migrations/${migration##*/}" -leaf="$OMARCHY_PATH/install/hardware/${leaf##*/}" -migration="$OMARCHY_PATH/migrations/${migration##*/}" +export OMARCHY_PATH="$ROOT" reset_fixture() { : >"$TEST_LOG" printf '%s' "$1" >"$TEST_VERSION_FILE" - rm -f "$firmware_pending" "$TEST_ALIAS_FILE" + rm -f "$TEST_ALIAS_FILE" } run_leaf() { @@ -85,12 +78,12 @@ for model in "XPS 9350" "XPS 13 DX13261"; do reset_fixture "20260810-2" TEST_PRODUCT_NAME="$model" run_leaf TEST_PRODUCT_NAME="$model" run_migration - [[ ! -s $TEST_LOG && ! -e $firmware_pending ]] || fail "other models receive no firmware repair" + [[ ! -s $TEST_LOG ]] || fail "other models receive no firmware repair" done reset_fixture "20260810-2" TEST_INTEL_PTL=0 run_leaf TEST_INTEL_PTL=0 run_migration -[[ ! -s $TEST_LOG && ! -e $firmware_pending ]] || fail "the Wildcat Lake variant receives no firmware repair" +[[ ! -s $TEST_LOG ]] || 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" "20260810-3" "20260810-4" "20260910-2" "20260916-1" "1:20260810-2"; do @@ -98,7 +91,6 @@ for version in "" "20260810-2" "20260810-3" "20260810-4" "20260910-2" "20260916- 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 "hardware setup leaves reboot bookkeeping to the migration" done pass "hardware setup installs the package identity without replacing any stock firmware" pass "hardware setup leaves reboot bookkeeping to the migration" @@ -106,10 +98,14 @@ pass "hardware setup leaves reboot bookkeeping to the migration" 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" +[[ ! -s $TEST_LOG ]] || fail "installed aliases are idempotent on stock firmware" pass "installed aliases are idempotent on stock firmware" +run_migration +[[ $(<"$TEST_LOG") == "state set reboot-required" ]] || + fail "the migration requests a reboot even if hardware setup already installed the aliases" +pass "the migration requests a reboot even if hardware setup already installed the aliases" + reset_fixture "20260810-2" if TEST_INSTALL_FAILURE=1 run_migration; then fail "a failed firmware installation fails the migration" @@ -129,37 +125,3 @@ run_migration [[ $(<"$TEST_LOG") == "state set reboot-required" ]] || fail "a second user before reboot is prompted without reinstalling" pass "a second user before reboot is prompted without reinstalling" - -: >"$TEST_LOG" -rm -f "$firmware_pending" -run_migration -[[ ! -s $TEST_LOG ]] || fail "the migration is a no-op after reboot with repaired firmware" -pass "the migration is a no-op after reboot with repaired firmware" - -reset_fixture "20260810-2" -rm -rf "$test_tmp/run" -touch "$test_tmp/run" -if run_migration 2>/dev/null; then - fail "failure to record the pending reboot fails the migration" -fi -[[ ! -s $TEST_LOG && $(<"$TEST_VERSION_FILE") == "20260810-2" ]] || - fail "failure to record the reboot marker installs nothing" -pass "failure to record the reboot marker installs nothing" - -rm -f "$test_tmp/run" -reset_fixture "20260810-2" -protected_file="$test_tmp/protected" -printf 'preserve me\n' >"$protected_file" -OMARCHY_XPS13_FIRMWARE_PENDING="$protected_file" run_migration -[[ $(<"$protected_file") == "preserve me" && -e $firmware_pending && $(<"$TEST_LOG") == "$install_call"$'\nstate set reboot-required' ]] || - fail "the invoking user's environment cannot redirect the privileged marker write" -pass "the invoking user's environment cannot redirect the privileged marker write" - -if [[ ${TEST_FIRMWARE_SPECIAL_TMPDIR:-0} != "1" ]]; then - special_tmpdir="$test_tmp/"'tmp &|"\$fixture' - mkdir -p "$special_tmpdir" - PATH="$test_path" TMPDIR="$special_tmpdir" TEST_FIRMWARE_SPECIAL_TMPDIR=1 \ - bash "$ROOT/test/shell.d/xps13-ptl-firmware-test.sh" >"$test_tmp/special-path.log" 2>&1 || - fail "firmware fixtures work with shell and sed metacharacters in TMPDIR" "$(<"$test_tmp/special-path.log")" - pass "firmware fixtures work with shell and sed metacharacters in TMPDIR" -fi