Use pacman -Syu when installing Arch packages

-Sy without -u is a partial upgrade and can install jq against a
newer glibc than the system has. Warn first, then run a full -Syu,
and fail if jq still cannot execute.
This commit is contained in:
soulis-1256 2026-08-16 13:54:32 +03:00
parent 6a142c75d8
commit 229ca00795
No known key found for this signature in database
2 changed files with 31 additions and 2 deletions

View file

@ -63,7 +63,11 @@ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev
}
install_docker_arch() {
sudo pacman -Sy --noconfirm --needed docker docker-compose
echo
echo "Arch Linux: about to run a full system upgrade (pacman -Syu)."
echo "A partial install (-Sy without -u) can break packages (GLIBC mismatch)."
echo
sudo pacman -Syu --noconfirm --needed docker docker-compose
}
install_docker_fedora() {

View file

@ -124,7 +124,12 @@ install_packages() {
sudo apt-get update -qq && sudo apt-get install -y "${pkgs[@]}"
;;
pacman)
sudo pacman -Sy --noconfirm --needed "${pkgs[@]}"
echo
log_warning "Arch Linux: about to run a full system upgrade (pacman -Syu)."
log_info "A partial install (-Sy without -u) can break jq (GLIBC mismatch)."
log_info "This updates the whole system, then installs: ${pkgs[*]}"
echo
sudo pacman -Syu --noconfirm --needed "${pkgs[@]}"
;;
dnf)
sudo dnf install -y "${pkgs[@]}"
@ -172,6 +177,26 @@ check_dependencies() {
if ! install_packages "${missing_packages[@]}"; then
log_error "Failed to install missing packages. Please install them manually: ${missing_packages[*]}"
fi
local still_broken=()
local pkg
for pkg in "${missing_packages[@]}"; do
case "$pkg" in
jq) echo "{}" | jq . &>/dev/null || still_broken+=("$pkg") ;;
fzf) fzf --version &>/dev/null || still_broken+=("$pkg") ;;
curl) curl --version &>/dev/null || still_broken+=("$pkg") ;;
*) command -v "$pkg" &>/dev/null || still_broken+=("$pkg") ;;
esac
done
if [ ${#still_broken[@]} -gt 0 ]; then
echo
log_warning "Installed, but still not runnable: ${still_broken[*]}"
if printf '%s\n' "${still_broken[@]}" | grep -qx jq; then
jq . </dev/null 2>&1 | head -5 || true
log_info "On Arch this is usually a partial upgrade. In WSL run: sudo pacman -Syu"
log_info "Then open a new WSL terminal and re-run setup."
fi
log_error "Please fix the packages above and re-run setup."
fi
log_success "Successfully installed missing packages"
else
log_error "Please install the required packages manually: ${missing_packages[*]}"