diff --git a/install.sh b/install.sh index 7c07e9f..55d1b27 100755 --- a/install.sh +++ b/install.sh @@ -25,6 +25,25 @@ DISTRO=$(detect_distro) # Dependencies # --------------------------------------------------------------------------- +# On Arch-based systems, partial upgrades are unsupported — installing a +# package that pulls in a newer library breaks packages built against the old +# one. The right fix is 'sudo pacman -Syu', but doing that over SSH risks +# a dropped connection mid-kernel-upgrade. So we just warn and let the user +# decide. +check_arch_updates() { + sudo pacman -Sy --noconfirm # refresh databases only, no upgrade + local updates + updates=$(pacman -Qu 2>/dev/null | wc -l) + if [[ "$updates" -gt 0 ]]; then + echo "" + echo "WARNING: $updates system package(s) are out of date." + echo " If pacman fails with dependency conflicts, run 'sudo pacman -Syu'" + echo " locally (not over SSH, to avoid kernel upgrade risks), then re-run" + echo " this script." + echo "" + fi +} + case "$DISTRO" in endeavouros) # EndeavourOS is Arch-based, use pacman @@ -52,6 +71,7 @@ case "$DISTRO" in firefox ) + check_arch_updates echo "Installing packages for EndeavourOS..." sudo pacman -S --noconfirm "${PACMAN_PACKAGES[@]}" ;; @@ -110,6 +130,7 @@ case "$DISTRO" in firefox ) + check_arch_updates echo "Installing packages for Arch Linux..." sudo pacman -S --noconfirm "${PACMAN_PACKAGES[@]}" ;;