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>
This commit is contained in:
1 parent
499f50ffd6
commit
db21abdef0
2 files changed
+16
-63
No files matched your search
@@ -1,15 +1,6 @@
|
|||||||
echo "Install the Dell XPS 13 Panther Lake speaker firmware"
|
echo "Install the Dell XPS 13 Panther Lake speaker firmware"
|
||||||
|
|
||||||
if omarchy-hw-dell-xps13-dx13260-ptl; then
|
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"
|
source "$OMARCHY_PATH/install/hardware/dell-xps13-ptl-speaker-firmware.sh"
|
||||||
|
omarchy-state set reboot-required
|
||||||
# The marker lasts until reboot so every user migrating beforehand is prompted.
|
|
||||||
if [[ -e $firmware_pending ]]; then
|
|
||||||
omarchy-state set reboot-required
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
@@ -25,7 +25,11 @@ cat >"$test_tmp/bin/omarchy-hw-intel-ptl" <<'SH'
|
|||||||
SH
|
SH
|
||||||
cat >"$test_tmp/bin/sudo" <<'SH'
|
cat >"$test_tmp/bin/sudo" <<'SH'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
exec "$@"
|
if [[ $1 == "pacman" ]]; then
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
|
printf 'Unexpected privileged command: %s\n' "$*" >&2
|
||||||
|
exit 1
|
||||||
SH
|
SH
|
||||||
cat >"$test_tmp/bin/pacman" <<'SH'
|
cat >"$test_tmp/bin/pacman" <<'SH'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
@@ -50,27 +54,16 @@ printf 'state %s\n' "$*" >>"$TEST_LOG"
|
|||||||
SH
|
SH
|
||||||
chmod +x "$test_tmp/bin/"*
|
chmod +x "$test_tmp/bin/"*
|
||||||
|
|
||||||
test_path="$PATH"
|
|
||||||
export PATH="$test_tmp/bin:$ROOT/bin:$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_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
|
export TEST_PRODUCT_NAME="XPS 13 DX13260" TEST_INTEL_PTL=1
|
||||||
install_call="pacman -S --noconfirm --needed -- linux-firmware-cirrus-dx13260"
|
install_call="pacman -S --noconfirm --needed -- linux-firmware-cirrus-dx13260"
|
||||||
firmware_pending="$test_tmp/run/pending"
|
export OMARCHY_PATH="$ROOT"
|
||||||
|
|
||||||
# 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##*/}"
|
|
||||||
|
|
||||||
reset_fixture() {
|
reset_fixture() {
|
||||||
: >"$TEST_LOG"
|
: >"$TEST_LOG"
|
||||||
printf '%s' "$1" >"$TEST_VERSION_FILE"
|
printf '%s' "$1" >"$TEST_VERSION_FILE"
|
||||||
rm -f "$firmware_pending" "$TEST_ALIAS_FILE"
|
rm -f "$TEST_ALIAS_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_leaf() {
|
run_leaf() {
|
||||||
@@ -85,12 +78,12 @@ for model in "XPS 9350" "XPS 13 DX13261"; do
|
|||||||
reset_fixture "20260810-2"
|
reset_fixture "20260810-2"
|
||||||
TEST_PRODUCT_NAME="$model" run_leaf
|
TEST_PRODUCT_NAME="$model" run_leaf
|
||||||
TEST_PRODUCT_NAME="$model" run_migration
|
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
|
done
|
||||||
reset_fixture "20260810-2"
|
reset_fixture "20260810-2"
|
||||||
TEST_INTEL_PTL=0 run_leaf
|
TEST_INTEL_PTL=0 run_leaf
|
||||||
TEST_INTEL_PTL=0 run_migration
|
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"
|
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
|
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"
|
run_leaf || fail "the alias package is installed during hardware setup"
|
||||||
[[ $(<"$TEST_LOG") == "$install_call" && $(<"$TEST_VERSION_FILE") == "$version" && -e $TEST_ALIAS_FILE ]] ||
|
[[ $(<"$TEST_LOG") == "$install_call" && $(<"$TEST_VERSION_FILE") == "$version" && -e $TEST_ALIAS_FILE ]] ||
|
||||||
fail "hardware setup installs the separate aliases without replacing stock firmware"
|
fail "hardware setup installs the separate aliases without replacing stock firmware"
|
||||||
[[ ! -e $firmware_pending ]] || fail "hardware setup leaves reboot bookkeeping to the migration"
|
|
||||||
done
|
done
|
||||||
pass "hardware setup installs the package identity without replacing any stock firmware"
|
pass "hardware setup installs the package identity without replacing any stock firmware"
|
||||||
pass "hardware setup leaves reboot bookkeeping to the migration"
|
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"
|
reset_fixture "20260810-2"
|
||||||
touch "$TEST_ALIAS_FILE"
|
touch "$TEST_ALIAS_FILE"
|
||||||
run_leaf
|
run_leaf
|
||||||
run_migration
|
[[ ! -s $TEST_LOG ]] || fail "installed aliases are idempotent on stock firmware"
|
||||||
[[ ! -s $TEST_LOG && ! -e $firmware_pending ]] || fail "installed aliases are idempotent on stock firmware"
|
|
||||||
pass "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"
|
reset_fixture "20260810-2"
|
||||||
if TEST_INSTALL_FAILURE=1 run_migration; then
|
if TEST_INSTALL_FAILURE=1 run_migration; then
|
||||||
fail "a failed firmware installation fails the migration"
|
fail "a failed firmware installation fails the migration"
|
||||||
@@ -129,37 +125,3 @@ run_migration
|
|||||||
[[ $(<"$TEST_LOG") == "state set reboot-required" ]] ||
|
[[ $(<"$TEST_LOG") == "state set reboot-required" ]] ||
|
||||||
fail "a second user before reboot is prompted without reinstalling"
|
fail "a second user before reboot is prompted without reinstalling"
|
||||||
pass "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
|
|
||||||
Reference in new issue
Block a user