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>
62 lines
2.0 KiB
Bash
Executable File
62 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Purpose : Stop a full system upgrade (pacman -Syu, yay -Syu, ...) that isn't
|
|
# run by CoreDesktop's update or install. pacman runs this as root
|
|
# before each transaction (system/pacman-guard.sh installs the hook);
|
|
# exiting non-zero aborts it.
|
|
#
|
|
# update skips its snapshot, keyring, mirror and initramfs checks, migrations
|
|
# and AUR rebuilds when pacman upgrades the system on its own. update and
|
|
# install.sh export COREDESKTOP_ALLOW_PACMAN=1, and so can you to get past this:
|
|
# COREDESKTOP_ALLOW_PACMAN=1 sudo pacman -Syu
|
|
|
|
# For the tests: where to read processes from, and which process is pacman
|
|
PROC="${PACMAN_GUARD_PROC:-/proc}"
|
|
pacman_pid="${PACMAN_GUARD_PID:-$PPID}"
|
|
|
|
# pacman's arguments, one per line. pacman runs its hooks itself, so it's the
|
|
# parent.
|
|
args=()
|
|
[ -r "$PROC/$pacman_pid/cmdline" ] && mapfile -d '' -t args < "$PROC/$pacman_pid/cmdline"
|
|
|
|
sync=0 sysupgrade=0
|
|
for arg in "${args[@]:1}"; do
|
|
case "$arg" in
|
|
--) break ;;
|
|
--sync) sync=1 ;;
|
|
--sysupgrade) sysupgrade=1 ;;
|
|
--*) ;;
|
|
-*)
|
|
[[ "$arg" == *S* ]] && sync=1
|
|
[[ "$arg" == *u* ]] && sysupgrade=1 ;;
|
|
esac
|
|
done
|
|
(( sync && sysupgrade )) || exit 0
|
|
|
|
# Allowed when pacman or any process that started it has the variable: sudo
|
|
# drops it from pacman's environment, but the sudo process itself still has it
|
|
pid="$pacman_pid"
|
|
while [[ "$pid" =~ ^[0-9]+$ ]] && (( pid > 1 )); do
|
|
if tr '\0' '\n' < "$PROC/$pid/environ" 2> /dev/null | grep -qx 'COREDESKTOP_ALLOW_PACMAN=1'; then
|
|
exit 0
|
|
fi
|
|
pid="$(awk '/^PPid:/ { print $2 }' "$PROC/$pid/status" 2> /dev/null)"
|
|
done
|
|
|
|
cat >&2 << 'EOF'
|
|
|
|
This is a full system upgrade outside CoreDesktop's update, so pacman stopped
|
|
before changing anything. Run this instead:
|
|
|
|
update
|
|
|
|
update also takes a snapshot first, updates the keyring and mirrors, checks the
|
|
new initramfs, runs CoreDesktop's migrations and updates the AUR packages.
|
|
|
|
To upgrade with pacman alone anyway:
|
|
|
|
COREDESKTOP_ALLOW_PACMAN=1 sudo pacman -Syu
|
|
|
|
EOF
|
|
exit 1
|