This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
deps-runtime
executable file
·69 lines (59 loc) · 2.23 KB
/
deps-runtime
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
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
echo "This script will install some required packages to use Kirigami64 on Linux."
printf "This updated script should automatically detect your package manager for installing dependencies. \e[1;31mIf it doesn't, you will need to find the dependencies yourself.\e[0m\n"
DOAS_CMD=""
PACMAN_INSTALL=""
PACMAN_PACKAGES=()
PACMAN_POST=()
WHOIS=$(whoami)
if [ "$WHOIS" == "root" ]; then
printf "\e[1;33mRunning as root user. If this is unintended, exit the script then exit the root shell or remove sudo/doas from your previous command.\e[0m\n"
elif [ -f "/usr/bin/sudo" ]; then
DOAS_CMD="sudo"
elif [ -f "/usr/bin/doas" ]; then
DOAS_CMD="doas"
else
>&2 echo "No valid doas command found, please install either sudo or doas."
exit 1
fi
if [ -f "/usr/bin/apt" ]; then
# TODO: Confirm these packages are correct
# BONUS TODO: Nala support
PACMAN_INSTALL="apt install"
PACMAN_PACKAGES=(build-essential git python3 libglew-dev libsdl2-dev)
elif [ -f "/usr/bin/dnf" ]; then
PACMAN_INSTALL="dnf install"
PACMAN_PACKAGES=(make gcc python3 glew-devel SDL2-devel)
elif [ -f "/usr/bin/pacman" ]; then
# Ensure KDE-Unstable is enabled (until KDE Plasma 6 is officially released)
>&2 printf "\e[1;31mUntil February 2024, this script will require the KDE-Unstable repository to be active and above the core & extra repositories\n\e[0m"
PACMAN_INSTALL="pacman -S"
PACMAN_PACKAGES=(base-devel python sdl2 glew kirigami2 kconfig ki18n kcoreaddons)
elif [ -f "/usr/bin/xbps-install" ]; then
PACMAN_INSTALL="xbps-install -S"
PACMAN_PACKAGES=(base-devel python3 SDL2-devel glew-devel)
else
>&2 printf "\e[1;31mFailed to automatically detect your package manager, manual intervention is required\n\e[0m"
exit
fi
printf "\e[1;33mThe following packages will be installed: "
echo "${PACMAN_PACKAGES[@]}"
printf "Is this okay [y/n]?\e[0m "
while true
do
# shellcheck disable=SC2162
read OKAY
if [[ "$OKAY" == "N" || "$OKAY" == "n" ]]; then
printf "Exiting now...\n\e[0m"
exit 1
elif [[ "$OKAY" == "Y" || "$OKAY" == "y" ]]; then
break
fi
done
# Splitting is intentional, so I'm disabling this warning
# shellcheck disable=SC2086
$DOAS_CMD $PACMAN_INSTALL "${PACMAN_PACKAGES[@]}"
if [[ ! "${#PACMAN_POST[@]}" -eq 0 ]]; then
$DOAS_CMD "${PACMAN_POST[@]}"
fi
exit