-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.sh
More file actions
executable file
·47 lines (38 loc) · 1009 Bytes
/
common.sh
File metadata and controls
executable file
·47 lines (38 loc) · 1009 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
#!/bin/bash
source scripts/dotenv
.env --file settings.env export
ARCH="/mnt"
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export ARCH ROOT
function yays {
local packages; packages=("$@")
for package in "${packages[@]}"; do
if ! yay -Qi "$package" > /dev/null 2>&1; then
echo "Installing package: $package"
yay -S --answerdiff N --answerclean A --needed --noconfirm --quiet "$package"
else
echo "Package $package already installed. Skipping..."
fi
done
}
function key_value {
local key; key=$1
local value; value=$2
local filename; filename=$3
if grep -P "^$key=" "$filename" > /dev/null 2>&1; then
sed --in-place "s/^$key=.*/$key=$value/" "$filename"
else
echo "$key=$value" >> "$filename"
fi
}
function snap_install {
local package; package=$1
local opts; opts=("${@:2}")
if ! snap list "$package" >/dev/null 2>&1; then
snap install "$package" "${opts[@]}"
fi
}
function panic {
echo "$@"
exit 1
}