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-compile
executable file
·67 lines (57 loc) · 2.62 KB
/
deps-compile
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
#!/bin/bash
echo "This script will install some required packages to compile 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 extra-cmake-modules cmake qtbase6-dev qttools6-dev-tools qtdeclarative6-dev libqt6svg6-dev qtquickcontrols2-6-dev qml-module-org-kde-kirigami2 kirigami2-dev libkf6i18n-dev libkf6config-dev gettext libkf6coreaddons-dev qml-module-qtquick-layouts libgit2-dev meson)
elif [ -f "/usr/bin/dnf" ]; then
PACMAN_INSTALL="dnf install"
PACMAN_POST=(dnf groupinstall "\"Development Tools\"" "\"Development Libraries\"")
PACMAN_PACKAGES=(extra-cmake-modules cmake qt6-qtbase-devel qt6-qtdeclarative-devel qt6-qtquickcontrols2-devel kf6-kirigami2 kf6-kirigami2-devel kf6-ki18n-devel kf6-kcoreaddons-devel kf6-kconfig-devel gettext libgit2 libgit2-devel meson)
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 extra-cmake-modules cmake kirigami2 kconfig ki18n kcoreaddons kde-sdk-meta gettext libgit2 meson)
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