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:
@@ -321,3 +321,96 @@ LIST
|
||||
[ "$status" -ne 0 ]
|
||||
not_called curl
|
||||
}
|
||||
|
||||
# --- unowned_conflicts, move_aside, put_back ---------------------------------
|
||||
|
||||
# A pacman -Su log that stopped on conflicting files: one line per path given
|
||||
conflict_log() {
|
||||
LOG="$BATS_TEST_TMPDIR/pacman.log"
|
||||
{
|
||||
echo ":: Proceed with installation? [Y/n] "
|
||||
echo "(2/2) checking for file conflicts [######] 100%"
|
||||
echo "error: failed to commit transaction (conflicting files)"
|
||||
for line in "$@"; do printf '%s\r\n' "$line"; done
|
||||
echo "Errors occurred, no packages were upgraded."
|
||||
} > "$LOG"
|
||||
}
|
||||
|
||||
@test "unowned_conflicts lists the files no package owns" {
|
||||
source "$REPO/utils.sh"
|
||||
stub pacman 'exit 1'
|
||||
conflict_log "python-foo: /usr/lib/python3.13/site-packages/foo/__init__.py exists in filesystem" \
|
||||
"python-foo: /usr/lib/python3.13/site-packages/foo exists in filesystem" \
|
||||
"bar: /usr/bin/bar exists in filesystem"
|
||||
run unowned_conflicts "$LOG"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "$(printf '%s\n' /usr/bin/bar /usr/lib/python3.13/site-packages/foo \
|
||||
/usr/lib/python3.13/site-packages/foo/__init__.py)" ]
|
||||
}
|
||||
|
||||
@test "unowned_conflicts gives up when a package owns a conflicting file" {
|
||||
source "$REPO/utils.sh"
|
||||
stub pacman 'exit 1'
|
||||
conflict_log "foo: /usr/bin/foo exists in filesystem" \
|
||||
"foo: /usr/bin/bar exists in filesystem (owned by bar)"
|
||||
run unowned_conflicts "$LOG"
|
||||
[ "$status" -eq 1 ]
|
||||
[ -z "$output" ]
|
||||
}
|
||||
|
||||
@test "unowned_conflicts gives up when pacman finds an owner now" {
|
||||
source "$REPO/utils.sh"
|
||||
stub pacman '[ "$2" = /usr/bin/foo ]'
|
||||
conflict_log "foo: /usr/bin/foo exists in filesystem"
|
||||
run unowned_conflicts "$LOG"
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "unowned_conflicts finds nothing in other failures" {
|
||||
source "$REPO/utils.sh"
|
||||
stub pacman 'exit 1'
|
||||
LOG="$BATS_TEST_TMPDIR/pacman.log"
|
||||
printf 'error: failed to prepare transaction (could not satisfy dependencies)\n' > "$LOG"
|
||||
run unowned_conflicts "$LOG"
|
||||
[ "$status" -eq 1 ]
|
||||
run unowned_conflicts "$BATS_TEST_TMPDIR/missing.log"
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "move_aside moves files and folders under REPLACED_DIR, and put_back returns them" {
|
||||
source "$REPO/utils.sh"
|
||||
stub sudo '"$@"'
|
||||
REPLACED_DIR="$BATS_TEST_TMPDIR/replaced"
|
||||
local file="$BATS_TEST_TMPDIR/usr/bin/foo" dir="$BATS_TEST_TMPDIR/usr/lib/foo"
|
||||
mkdir -p "$dir" "$(dirname "$file")"
|
||||
echo old > "$file"
|
||||
echo x > "$dir/x"
|
||||
|
||||
run move_aside "$file" "$dir"
|
||||
[ "$status" -eq 0 ]
|
||||
[ ! -e "$file" ] && [ ! -e "$dir" ]
|
||||
[ "$(cat "$REPLACED_DIR$file")" = old ]
|
||||
[ -f "$REPLACED_DIR$dir/x" ]
|
||||
|
||||
# The upgrade installed its own foo, but not the folder
|
||||
echo new > "$file"
|
||||
run put_back "$file" "$dir"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$(cat "$file")" = new ]
|
||||
[ -f "$dir/x" ]
|
||||
[ "$(cat "$REPLACED_DIR$file")" = old ]
|
||||
}
|
||||
|
||||
@test "move_aside keeps what an earlier move left in REPLACED_DIR" {
|
||||
source "$REPO/utils.sh"
|
||||
stub sudo '"$@"'
|
||||
REPLACED_DIR="$BATS_TEST_TMPDIR/replaced"
|
||||
local file="$BATS_TEST_TMPDIR/usr/bin/foo"
|
||||
mkdir -p "$(dirname "$file")"
|
||||
echo first > "$file"
|
||||
move_aside "$file"
|
||||
echo second > "$file"
|
||||
move_aside "$file"
|
||||
[ "$(cat "$REPLACED_DIR$file")" = second ]
|
||||
[ "$(cat "$REPLACED_DIR$file.~1~")" = first ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user