fix: paru-bin (pre-compiled) statt paru aus Source bauen

Alter Code:
- paru aus Source (braucht rustup + rust compiler → langsam + Fehleranfällig)
- 2>/dev/null + 2>&1 | tail -5 versteckte ALLE Fehler
- makepkg als root ausgeführt → schlägt fehl (makepkg verweigert root)
- yay als zweiter Versuch hatte die selben Probleme

Neuer Code:
- paru-bin (pre-compiled binary, kein Rust nötig)
- KEINE stderr-Unterdrückung mehr → Fehler sichtbar
- is_root()-Check: klare Warnung + Anleitung falls als root ausgeführt
- yay-bin als Fallback falls paru-bin scheitert
This commit is contained in:
2026-05-27 22:53:36 +02:00
parent 5c6c0f3fed
commit 06a21fb8c2

View File

@@ -267,29 +267,48 @@ install_aur_helper() {
return 0
fi
if ! command -v git >/dev/null 2>&1; then
sudo_run pacman -S --needed --noconfirm git base-devel
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"
return 1
fi
command -v git >/dev/null 2>&1 || sudo_run pacman -S --needed --noconfirm git
local build_dir
build_dir="$(mktemp -d)"
sudo_run pacman -S --needed --noconfirm rustup 2>/dev/null || true
if have rustup; then
rustup default stable >/dev/null 2>&1 || true
tui_info "Downloading paru-bin from AUR..."
if ! git clone https://aur.archlinux.org/paru-bin.git "$build_dir/paru-bin"; then
tui_error "Failed to download paru-bin. Check network connectivity."
rm -rf "$build_dir"
return 1
fi
if git clone https://aur.archlinux.org/paru.git "$build_dir/paru" 2>/dev/null; then
(cd "$build_dir/paru" && makepkg -si --needed --noconfirm) 2>&1 | tail -5 || {
tui_warn "paru build failed, trying yay..."
if git clone https://aur.archlinux.org/yay.git "$build_dir/yay" 2>/dev/null; then
(cd "$build_dir/yay" && makepkg -si --needed --noconfirm) 2>&1 | tail -5 || {
tui_warn "yay build failed too. Install manually: paru -S paru-bin"
}
fi
}
tui_info "Building paru-bin with makepkg..."
if (cd "$build_dir/paru-bin" && makepkg -si --needed --noconfirm); then
tui_success "paru installed successfully"
rm -rf "$build_dir"
return 0
fi
local rc=$?
tui_warn "makepkg failed (exit $rc). Trying yay-bin..."
rm -rf "$build_dir/paru-bin"
if git clone https://aur.archlinux.org/yay-bin.git "$build_dir/yay-bin"; then
if (cd "$build_dir/yay-bin" && makepkg -si --needed --noconfirm); then
tui_success "yay installed successfully"
rm -rf "$build_dir"
return 0
fi
fi
tui_warn "Could not install AUR helper. Install manually:"
tui_info " cd /tmp && git clone https://aur.archlinux.org/paru-bin.git"
tui_info " cd paru-bin && makepkg -si"
rm -rf "$build_dir"
return 1
}