dev/runs/paru

59 lines
1,020 B
Bash
Executable file

#!/usr/bin/env bash
# NAME: Install paru AUR helper
set -euo pipefail
# Source common functions
source "$(dirname "$0")/../common.sh" || {
echo "[ERROR] Could not source common.sh" >&2
exit 1
}
check_requirements() {
local required_commands=(git makepkg)
for cmd in "${required_commands[@]}"; do
if ! command_exists "$cmd"; then
log_error "Required command not found: $cmd"
exit 1
fi
done
}
install_paru() {
if command_exists paru; then
log_info "paru is already installed"
return 0
fi
log_info "Installing build dependencies"
sudo pacman -S --needed --noconfirm base-devel git
local tmpdir
tmpdir=$(mktemp -d)
log_info "Using temporary directory: $tmpdir"
cd "$tmpdir"
log_info "Cloning paru repository"
git clone https://aur.archlinux.org/paru.git
cd paru
log_info "Building and installing paru"
makepkg -si --noconfirm
log_info "Cleaning up temporary files"
cd /
rm -rf "$tmpdir"
}
main() {
init_script
check_requirements
install_paru
finish_script 0
}
main "$@"