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:
+55
-1
@@ -34,7 +34,61 @@ sudo pacman -Sy --needed --noconfirm archlinux-keyring || STATUS=1
|
||||
echo "Updating Arch..."
|
||||
mkdir -p "$(dirname "$PACMAN_UPDATE_LOG")"
|
||||
: > "$PACMAN_UPDATE_LOG"
|
||||
sudo script -qefc "pacman -Su --noconfirm" "$PACMAN_UPDATE_LOG" || STATUS=1
|
||||
|
||||
# Run pacman -Su with the options given, adding its output to the log
|
||||
upgrade() {
|
||||
sudo script -qaefc "pacman -Su $*" "$PACMAN_UPDATE_LOG"
|
||||
}
|
||||
|
||||
# Ask a question on the terminal, if there is one; the default is yes
|
||||
ask_yes() {
|
||||
local answer
|
||||
{ : < /dev/tty; } 2> /dev/null || return 1
|
||||
read -rp "$1 [Y/n] " answer < /dev/tty || return 1
|
||||
[[ "$answer" != [nN]* ]]
|
||||
}
|
||||
|
||||
# Two things stop an upgrade that a second try gets past. Either way, pacman
|
||||
# changed nothing the first time.
|
||||
retry_upgrade() {
|
||||
local files=()
|
||||
|
||||
# A package that replaces or conflicts with an installed one: pacman asks
|
||||
# whether to remove that one, and --noconfirm answers no. Which to keep is
|
||||
# yours to decide (pacman says which above), so ask again without it.
|
||||
if grep -q 'unresolvable package conflicts detected' "$PACMAN_UPDATE_LOG"; then
|
||||
if ! { : < /dev/tty; } 2> /dev/null; then
|
||||
echo "Packages conflict, and pacman needs you to choose. Run update in a terminal."
|
||||
return 1
|
||||
fi
|
||||
echo -e "\e[33mPackages conflict, and pacman needs you to choose. Asking again:\e[0m"
|
||||
upgrade
|
||||
return
|
||||
fi
|
||||
|
||||
# Files no package owns where a package now installs its own (left by pip,
|
||||
# make install or an earlier installer): pacman won't install over them. Move
|
||||
# them aside and try again, and put back any it didn't replace.
|
||||
mapfile -t files < <(unowned_conflicts "$PACMAN_UPDATE_LOG")
|
||||
(( ${#files[@]} > 0 )) || return 1
|
||||
echo -e "\e[33mThe upgrade stopped because these files are in the way. No package owns them,\e[0m"
|
||||
echo -e "\e[33mand a package now installs its own:\e[0m"
|
||||
printf ' %s\n' "${files[@]}"
|
||||
if ! ask_yes "Move them to $REPLACED_DIR and upgrade again?"; then
|
||||
echo "Left them. Move or delete them, then run update again."
|
||||
return 1
|
||||
fi
|
||||
move_aside "${files[@]}" || { put_back "${files[@]}"; return 1; }
|
||||
if upgrade --noconfirm; then
|
||||
echo "Upgraded. What was there before is in $REPLACED_DIR, if you need any of it."
|
||||
return 0
|
||||
fi
|
||||
echo "Putting back what the upgrade didn't replace:"
|
||||
put_back "${files[@]}"
|
||||
return 1
|
||||
}
|
||||
|
||||
upgrade --noconfirm || retry_upgrade || STATUS=1
|
||||
|
||||
if initramfs_build_failed; then
|
||||
echo -e "\e[31mRebuilding the initramfs failed. Don't reboot until it's fixed - see the output above or $PACMAN_UPDATE_LOG.\e[0m"
|
||||
|
||||
Reference in New Issue
Block a user