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:
@@ -205,6 +205,55 @@ initramfs_build_failed() {
|
||||
(( succeeded == 0 || succeeded < built ))
|
||||
}
|
||||
|
||||
# Where unowned_conflicts' files are moved, under their full paths, so they
|
||||
# can be put back. Outside the directories they came from: a copy left in
|
||||
# /etc/sddm.conf.d or /usr/lib/systemd/system-sleep would still be live.
|
||||
REPLACED_DIR="${REPLACED_DIR:-/var/lib/coredesktop/replaced}"
|
||||
|
||||
# Print the files and directories pacman refused to install over, one per line,
|
||||
# when the upgrade in log $1 stopped on conflicting files that no package owns
|
||||
# (left by pip, make install or an earlier installer). Prints nothing, and
|
||||
# fails, when any conflicting path is owned by a package: moving the rest
|
||||
# wouldn't let the upgrade through.
|
||||
unowned_conflicts() {
|
||||
local log="$1" lines=() line path paths=()
|
||||
[ -f "$log" ] || return 1
|
||||
grep -q 'failed to commit transaction (conflicting files)' "$log" || return 1
|
||||
mapfile -t lines < <(tr -d '\r' < "$log" | grep -E '^[^ :]+: /.* exists in filesystem( \(owned by [^)]*\))?$')
|
||||
(( ${#lines[@]} > 0 )) || return 1
|
||||
for line in "${lines[@]}"; do
|
||||
[[ "$line" == *"(owned by "* ]] && return 1
|
||||
path="${line#*: }"
|
||||
path="${path% exists in filesystem}"
|
||||
# Checked again: pacman's message may be from before something changed
|
||||
pacman -Qo "$path" &> /dev/null && return 1
|
||||
paths+=("$path")
|
||||
done
|
||||
printf '%s\n' "${paths[@]}" | sort -u
|
||||
}
|
||||
|
||||
# Move each path given to the same path under REPLACED_DIR, keeping any copy
|
||||
# already there (numbered backups)
|
||||
move_aside() {
|
||||
local path
|
||||
for path in "$@"; do
|
||||
sudo mkdir -p "$REPLACED_DIR$(dirname "$path")" || return 1
|
||||
sudo mv -T --backup=numbered "$path" "$REPLACED_DIR$path" || return 1
|
||||
echo " $path -> $REPLACED_DIR$path"
|
||||
done
|
||||
}
|
||||
|
||||
# Put back each path given that move_aside moved and nothing has replaced
|
||||
# since. -L too: -e is false for a dangling symlink.
|
||||
put_back() {
|
||||
local path
|
||||
for path in "$@"; do
|
||||
if [[ ! -e "$path" && ! -L "$path" ]] && [[ -e "$REPLACED_DIR$path" || -L "$REPLACED_DIR$path" ]]; then
|
||||
sudo mv -T "$REPLACED_DIR$path" "$path" && echo " $path"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# pacman downloads from the first mirror in this list (system/mirrors.sh keeps
|
||||
# it fresh). Overridable for the tests.
|
||||
MIRRORLIST="${MIRRORLIST:-/etc/pacman.d/mirrorlist}"
|
||||
|
||||
Reference in New Issue
Block a user