-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.sh
More file actions
executable file
·47 lines (39 loc) · 955 Bytes
/
Copy pathutils.sh
File metadata and controls
executable file
·47 lines (39 loc) · 955 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
# Credit to typecraft-dev/crucible for a lot of parts of this script
newline() { echo ""; }
# Function to check if a package is installed
is_installed() {
pacman -Qi "$1" &>/dev/null
}
check_installed_helper() {
if pacman -Qi yay &>/dev/null; then
helper="yay"
elif pacman -Qi paru &>/dev/null; then
helper="paru"
else
newline
echo "Yay or Paru are not installed!"
exit 1
fi
}
install_packages() {
local packages=("$@")
local to_install=()
if [ -z "$helper" ]; then
newline
echo "Error: AUR helper not defined!"
exit 1
fi
for pkg in "${packages[@]}"; do
if ! is_installed "$pkg"; then
to_install+=("$pkg")
fi
done
if [ ${#to_install[@]} -ne 0 ]; then
newline
echo "Installing: ${to_install[*]}"
if ! "$helper" -S --needed "${to_install[@]}"; then
echo "Warning: Failed to install some packages in this group, continuing..."
fi
fi
}