Files
omarchy/test/shell.d/update-pacman-test.sh
T
Spencer BullandGPT-6.1-Sol High 033b5ecd3d 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 <noreply@openai.com>
Co-Authored-By: GPT-6.1-Sol XHigh <noreply@openai.com>
2026-10-06 00:30:29 -05:00

44 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
source "$(dirname "$0")/base-test.sh"
test_tmp=$(mktemp -d)
trap 'rm -rf "$test_tmp"' EXIT
stub_bin="$test_tmp/bin"
mkdir -p "$stub_bin"
cat >"$stub_bin/sudo" <<'STUB'
#!/bin/bash
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" "$@"
}
# The scope wrapper only applies on a systemd-booted host, so expect what the
# helper's own booted check would decide for this machine.
if [[ -d /run/systemd/system && ! -L /run/systemd/system ]]; then
expected_scope="systemd-run --scope --quiet --collect "
else
expected_scope=""
fi
# The baseline has no locale override; forwarding is tested below.
unset LC_ALL
run_helper -Syu --noconfirm
[[ $(cat "$test_tmp/call") == "env OMARCHY_UPDATE_PACMAN=1 ${expected_scope}pacman -Syu --noconfirm" ]] ||
fail "helper composes the guarded pacman invocation" "$(cat "$test_tmp/call")"
pass "helper composes the guarded pacman invocation"
LC_ALL=C run_helper -Syu
[[ $(cat "$test_tmp/call") == "env OMARCHY_UPDATE_PACMAN=1 LC_ALL=C ${expected_scope}pacman -Syu" ]] ||
fail "helper forwards LC_ALL to the transaction" "$(cat "$test_tmp/call")"
pass "helper forwards LC_ALL to the transaction"