-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_once_before_base.sh
57 lines (50 loc) · 1010 Bytes
/
run_once_before_base.sh
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
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -eo pipefail
# shellcheck disable=1091
OS=$(
source /etc/os-release
echo "$ID"
)
if [[ "$OS" != "manjaro" ]]; then
echo "Not Manjaro, skipping."
exit 0
fi
# Base requirements
requirements=(
"curl"
"git"
"unzip"
"zip"
"manjaro-tools-base"
)
for requirement in "${requirements[@]}"; do
if ! [[ -x "$(command -v "$requirement")" ]]; then
sudo pacman -Syu --noconfirm --needed "$requirement"
fi
done
# Pacman base-devel
base_devel=$(
pacman -Qi "base-devel" >/dev/null 2>&1
echo "$?"
)
if [[ "$base_devel" -ne "0" ]]; then
echo "base-devel [installing]"
sudo pacman -S --needed --noconfirm "base-devel"
echo "base-devel [installed]"
else
echo "base-devel [installed]"
fi
# Yay
if ! [[ -x "$(command -v git)" ]]; then
pacman -S --noconfirm git
fi
if ! [[ -x "$(command -v yay)" ]]; then
pwdir=$(pwd)
cd /tmp/ || exit
git clone https://aur.archlinux.org/yay-git.git yay
cd yay || exit
makepkg -si --noconfirm
cd .. || exit
rm -rf yay
cd "$pwdir" || exit
fi