Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion install/hardware/intel/ptl-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ if omarchy-hw-match "XPS" && omarchy-hw-intel-ptl; then
echo "Detected Dell XPS Panther Lake, installing PTL kernel..."

omarchy-pkg-add linux-ptl linux-ptl-headers
pacman -Rdd --noconfirm linux linux-headers || true
# pacman -R aborts the whole transaction when any target is missing, so a
# machine without linux-headers would keep stock linux too.
for pkg in linux linux-headers; do
pacman -Qq "$pkg" &>/dev/null || continue
pacman -Rdd --noconfirm "$pkg" || echo "WARNING: could not remove $pkg"
done

# linux-ptl doesn't provide=linux, so anything depending on linux drags the
# stock kernel back in and the boot menu grows a second, slower entry.
Expand Down
18 changes: 18 additions & 0 deletions test/shell.d/ptl-kernel-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

script="$ROOT/install/hardware/intel/ptl-kernel.sh"

if grep -E 'pacman[[:space:]]+-Rdd.*linux-headers.*[[:space:]]linux([[:space:]]|$)|pacman[[:space:]]+-Rdd.*[[:space:]]linux[[:space:]].*linux-headers' "$script" >/dev/null; then
fail "PTL kernel swap must not abort the whole removal when linux-headers is missing"
fi
pass "PTL kernel swap does not remove linux and linux-headers in one transaction"

grep -q 'for pkg in linux linux-headers' "$script" ||
fail "PTL kernel swap removes each stock kernel package on its own"
grep -Fq 'pacman -Rdd --noconfirm "$pkg" ||' "$script" ||
fail "PTL kernel swap keeps a failed package removal from aborting the boot-order drop-in"
pass "PTL kernel swap removes each stock kernel package on its own"