fix: prefer yay-bin (static Go binary, no libalpm dep) over paru-bin

This commit is contained in:
2026-05-29 00:50:26 +02:00
parent 041a8c33ea
commit ad46515b5a

View File

@@ -260,21 +260,6 @@ install_aur_package() {
return $rc
}
_install_paru_bin() {
local build_dir="$1"
git clone https://aur.archlinux.org/paru-bin.git "$build_dir/paru-bin" 2>/dev/null || return 1
(cd "$build_dir/paru-bin" && makepkg -si --needed --noconfirm) 2>/dev/null || return 1
return 0
}
_install_paru_source() {
local build_dir="$1"
sudo_run pacman -S --needed --noconfirm go
git clone https://aur.archlinux.org/paru.git "$build_dir/paru" 2>/dev/null || return 1
(cd "$build_dir/paru" && makepkg -si --needed --noconfirm) 2>/dev/null || return 1
return 0
}
install_aur_helper() {
if have paru || have yay; then
return 0
@@ -282,9 +267,7 @@ install_aur_helper() {
if is_root; then
tui_warn "Running as root — makepkg refuses to run as root."
tui_info "Switch to a normal user with sudo access and re-run, or install paru manually:"
tui_info " pacman -S --needed git && git clone https://aur.archlinux.org/paru-bin.git"
tui_info " cd paru-bin && makepkg -si"
tui_info "Switch to a normal user with sudo access and re-run."
return 1
fi
@@ -294,39 +277,29 @@ install_aur_helper() {
local build_dir
build_dir="$(mktemp -d)"
tui_info "Installing paru-bin (binary AUR helper)..."
if _install_paru_bin "$build_dir" && paru --version >/dev/null 2>&1; then
tui_info "Installing yay-bin (statically linked, works on any libalpm)..."
if git clone https://aur.archlinux.org/yay-bin.git "$build_dir/yay-bin" &&
(cd "$build_dir/yay-bin" && makepkg -si --needed --noconfirm); then
tui_success "yay installed"
rm -rf "$build_dir"
return 0
fi
rm -rf "$build_dir"
mkdir -p "$build_dir"
tui_info "yay-bin failed. Trying paru-bin..."
if git clone https://aur.archlinux.org/paru-bin.git "$build_dir/paru-bin" &&
(cd "$build_dir/paru-bin" && makepkg -si --needed --noconfirm) &&
paru --version >/dev/null 2>&1; then
tui_success "paru works"
rm -rf "$build_dir"
return 0
fi
tui_warn "paru-bin failed or has library mismatch. Building paru from source..."
rm -rf "$build_dir"/*
mkdir -p "$build_dir"
if _install_paru_source "$build_dir"; then
tui_success "paru built and installed from source"
rm -rf "$build_dir"
tui_warn "No working AUR helper. Using direct git clone + makepkg for AUR packages."
return 0
fi
tui_warn "paru source build failed. Trying yay as fallback..."
rm -rf "$build_dir"/*
if git clone https://aur.archlinux.org/yay-bin.git "$build_dir/yay-bin" 2>/dev/null; then
if (cd "$build_dir/yay-bin" && makepkg -si --needed --noconfirm) 2>/dev/null; then
tui_success "yay installed successfully"
rm -rf "$build_dir"
return 0
fi
fi
tui_warn "Could not install any AUR helper. Install manually:"
tui_info " sudo pacman -S go && git clone https://aur.archlinux.org/paru.git"
tui_info " cd paru && makepkg -si"
rm -rf "$build_dir"
return 1
}
install_aur() {
@@ -339,7 +312,14 @@ install_aur() {
continue
fi
if have paru && paru --version >/dev/null 2>&1; then
if have yay; then
tui_info "Installing $pkg from AUR (via yay)..."
if yay -S --needed --noconfirm "$pkg"; then
tui_success "$pkg installed"
continue
fi
tui_warn "yay failed for $pkg. Trying direct AUR install..."
elif have paru && paru --version >/dev/null 2>&1; then
tui_info "Installing $pkg from AUR (via paru)..."
if paru -S --needed --noconfirm "$pkg"; then
tui_success "$pkg installed"