Add upgrade safeguards, hardware setup, sign-in options and Taildrop from Omarchy
shellcheck / shellcheck (push) Failing after 19s
shellcheck / shellcheck (push) Failing after 19s
Adapted from Omarchy (github.com/omacom/omarchy) for Arch with GNOME: - A pacman hook stops a full upgrade run without update (pacman -Syu, yay -Syu), which would skip the snapshot and update's checks. update and install.sh set COREDESKTOP_ALLOW_PACMAN=1, which the hook finds on pacman or any process above it; you can set it too. - When the Arch upgrade stops on files no package owns, update lists them and asks to move them to /var/lib/coredesktop/replaced and try again, putting back what the retry didn't replace. When packages conflict, it runs pacman again so you can choose. - update and install keep the computer from sleeping until they finish. - system/hardware.sh (install, and a migration): the Wi-Fi country from the time zone, thermald and intel-lpmd on Intel laptops, and Wi-Fi 6 on Intel BE200/BE211 cards, whose driver gets Wi-Fi 7 wrong. - configure security-key and configure fingerprint: touch a FIDO2 key or a finger instead of typing your password for sudo and polkit, falling back to the password. Each shows only when the hardware is there. The fingerprint skips to the password with the lid shut. - webapp: put a website in the app grid as its own app window. - Taildrop: Files' Scripts > Send with Tailscale, and a user service that saves files sent here to Downloads, started when configure tailscale joins. - A NetworkManager dispatcher script pauses a Tailscale exit node while you sign in to a captive portal, and resumes it once online. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
# system/hardware.sh on a fake machine under $HARDWARE_ROOT, with fake pacman,
|
||||
# yay, sudo and systemctl
|
||||
|
||||
setup() {
|
||||
common_setup
|
||||
export COREDESKTOP="$REPO"
|
||||
export HARDWARE_ROOT="$BATS_TEST_TMPDIR/root"
|
||||
R="$HARDWARE_ROOT"
|
||||
mkdir -p "$R/sys/class/ieee80211" "$R/sys/class/power_supply" "$R/sys/bus/pci/devices" \
|
||||
"$R/proc" "$R/etc/conf.d" "$R/usr/share/zoneinfo/Europe"
|
||||
printf '# Countries\nUS\t+404251-0740023\tAmerica/New_York\nDE\t+5230+01322\tEurope/Berlin\n' \
|
||||
> "$R/usr/share/zoneinfo/zone.tab"
|
||||
touch "$R/usr/share/zoneinfo/Europe/Berlin"
|
||||
ln -s "$R/usr/share/zoneinfo/Europe/Berlin" "$R/etc/localtime"
|
||||
printf '#WIRELESS_REGDOM="DE"\n#WIRELESS_REGDOM="US"\n' > "$R/etc/conf.d/wireless-regdom"
|
||||
cpu AuthenticAMD 25 33
|
||||
stub pacman 'exit 1'
|
||||
stub yay
|
||||
stub sudo '"$@"'
|
||||
stub systemctl '[ "$1" != is-enabled ]'
|
||||
}
|
||||
|
||||
cpu() {
|
||||
printf 'processor\t: 0\nvendor_id\t: %s\ncpu family\t: %s\nmodel\t\t: %s\n' "$1" "$2" "$3" > "$R/proc/cpuinfo"
|
||||
}
|
||||
|
||||
wifi() { mkdir -p "$R/sys/class/ieee80211/phy0"; }
|
||||
battery() { mkdir -p "$R/sys/class/power_supply/BAT0"; }
|
||||
|
||||
pci() {
|
||||
mkdir -p "$R/sys/bus/pci/devices/$1"
|
||||
echo "0x$2" > "$R/sys/bus/pci/devices/$1/vendor"
|
||||
echo "0x$3" > "$R/sys/bus/pci/devices/$1/device"
|
||||
}
|
||||
|
||||
@test "hardware.sh sets the Wi-Fi country from the time zone" {
|
||||
wifi
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
called yay -S --noconfirm --answerdiff=None --answeredit=None --answerclean=None wireless-regdb
|
||||
grep -qx 'WIRELESS_REGDOM="DE"' "$R/etc/conf.d/wireless-regdom"
|
||||
}
|
||||
|
||||
@test "hardware.sh leaves a Wi-Fi country that's set" {
|
||||
wifi
|
||||
echo 'WIRELESS_REGDOM="FR"' >> "$R/etc/conf.d/wireless-regdom"
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$(grep -c '^WIRELESS_REGDOM' "$R/etc/conf.d/wireless-regdom")" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "hardware.sh says so when the time zone has no country" {
|
||||
wifi
|
||||
ln -sfn "$R/usr/share/zoneinfo/UTC" "$R/etc/localtime"
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Couldn't tell the country"* ]]
|
||||
refute grep -q '^WIRELESS_REGDOM' "$R/etc/conf.d/wireless-regdom"
|
||||
}
|
||||
|
||||
@test "hardware.sh does nothing for Wi-Fi without it" {
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
not_called yay
|
||||
refute grep -q '^WIRELESS_REGDOM' "$R/etc/conf.d/wireless-regdom"
|
||||
}
|
||||
|
||||
@test "hardware.sh runs thermald and intel-lpmd on a newer Intel laptop" {
|
||||
battery
|
||||
cpu GenuineIntel 6 170
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
called yay -S --noconfirm --answerdiff=None --answeredit=None --answerclean=None thermald
|
||||
called yay -S --noconfirm --answerdiff=None --answeredit=None --answerclean=None intel-lpmd
|
||||
called systemctl enable thermald.service
|
||||
called systemctl enable intel_lpmd.service
|
||||
}
|
||||
|
||||
@test "hardware.sh runs only thermald on an older Intel laptop" {
|
||||
battery
|
||||
cpu GenuineIntel 6 142
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
called systemctl enable thermald.service
|
||||
uncalled systemctl enable intel_lpmd.service
|
||||
}
|
||||
|
||||
@test "hardware.sh leaves Intel desktops and AMD laptops alone" {
|
||||
cpu GenuineIntel 6 170
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
not_called systemctl
|
||||
battery
|
||||
cpu AuthenticAMD 25 33
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
not_called systemctl
|
||||
}
|
||||
|
||||
@test "hardware.sh turns off Wi-Fi 7 on an Intel BE200" {
|
||||
pci 0000:00:14.3 8086 272b
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
grep -qx 'options iwlwifi disable_11be=Y' "$R/etc/modprobe.d/iwlwifi-disable-eht.conf"
|
||||
}
|
||||
|
||||
@test "hardware.sh leaves other Wi-Fi cards on Wi-Fi 7" {
|
||||
pci 0000:00:14.3 8086 7e40
|
||||
run bash "$REPO/system/hardware.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
[ ! -e "$R/etc/modprobe.d/iwlwifi-disable-eht.conf" ]
|
||||
}
|
||||
Reference in New Issue
Block a user