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"