-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaur-helper.sh
More file actions
executable file
·47 lines (35 loc) · 1003 Bytes
/
aur-helper.sh
File metadata and controls
executable file
·47 lines (35 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /usr/bin/env bash
newline() { echo ""; }
echo "--------------------------------------------------------------------------------"
helper="$1"
# if no argument was provided to the script
if [[ -z "$helper" ]]; then
echo -ne "Choose an AUR helper to install (paru/yay): "
read -r helper
fi
# make input lowercase
helper=$(echo "$helper" | tr '[:upper:]' '[:lower:]')
if [[ "$helper" != "paru" && "$helper" != "yay" ]]; then
newline
echo "Invalid choice. Please select 'paru' or 'yay'."
exit 1
fi
if command -v "$helper" >/dev/null 2>&1; then
newline
echo "$helper is already installed!"
exit 0
fi
newline
echo "Installing required dependencies."
sudo pacman -S --needed --noconfirm git base-devel
tmp_dir=$(mktemp -d)
newline
echo "Cloning $helper into $tmp_dir."
git clone "https://aur.archlinux.org/${helper}.git" "$tmp_dir/$helper"
cd "$tmp_dir/$helper"
echo "Building $helper"
makepkg -si --noconfirm
newline
echo "DONE!"
rm -rf "$tmp_dir"
echo "Removed temporary files"