linutil/tabs/system-setup/1-compile-setup.sh

86 lines
3.3 KiB
Bash
Raw Normal View History

2024-07-15 20:00:04 +01:00
#!/bin/sh -e
. ../common-script.sh
2024-07-13 02:57:34 +01:00
installDepend() {
## Check for dependencies.
DEPENDENCIES='tar tree multitail tldr trash-cli unzip cmake make jq'
echo -e "${YELLOW}Installing dependencies...${RC}"
2024-07-13 02:57:34 +01:00
case $PACKAGER in
pacman)
if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then
2024-08-23 14:12:47 +01:00
echo "[multilib]" | $ESCALATION_TOOL tee -a /etc/pacman.conf
echo "Include = /etc/pacman.d/mirrorlist" | $ESCALATION_TOOL tee -a /etc/pacman.conf
$ESCALATION_TOOL "$PACKAGER" -Syu
2024-07-13 02:57:34 +01:00
else
echo "Multilib is already enabled."
fi
if ! command_exists yay && ! command_exists paru; then
echo "Installing yay as AUR helper..."
2024-08-23 14:12:47 +01:00
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-git.git && $ESCALATION_TOOL chown -R "$USER":"$USER" ./yay-git
2024-07-13 02:57:34 +01:00
cd yay-git && makepkg --noconfirm -si
else
echo "Aur helper already installed"
fi
if command_exists yay; then
AUR_HELPER="yay"
elif command_exists paru; then
AUR_HELPER="paru"
else
echo "No AUR helper found. Please install yay or paru."
exit 1
fi
2024-08-23 14:12:47 +01:00
$AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES"
2024-07-13 02:57:34 +01:00
;;
2024-07-30 21:29:36 +01:00
apt-get|nala)
2024-07-13 02:57:34 +01:00
COMPILEDEPS='build-essential'
2024-08-23 14:12:47 +01:00
$ESCALATION_TOOL "$PACKAGER" update
$ESCALATION_TOOL dpkg --add-architecture i386
$ESCALATION_TOOL "$PACKAGER" update
$ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
2024-07-13 02:57:34 +01:00
;;
dnf)
COMPILEDEPS='@development-tools'
2024-08-23 14:12:47 +01:00
$ESCALATION_TOOL "$PACKAGER" update
$ESCALATION_TOOL "$PACKAGER" config-manager --set-enabled powertools
$ESCALATION_TOOL "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS
$ESCALATION_TOOL "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
2024-07-13 02:57:34 +01:00
;;
zypper)
COMPILEDEPS='patterns-devel-base-devel_basis'
2024-08-23 14:12:47 +01:00
$ESCALATION_TOOL "$PACKAGER" refresh
$ESCALATION_TOOL "$PACKAGER" --non-interactive install "$DEPENDENCIES" $COMPILEDEPS
$ESCALATION_TOOL "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
2024-07-13 02:57:34 +01:00
;;
*)
2024-08-23 14:12:47 +01:00
$ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES # Fixed bug where no packages found on debian-based
2024-07-13 02:57:34 +01:00
;;
esac
}
install_additional_dependencies() {
case $(command -v apt || command -v zypper || command -v dnf || command -v pacman) in
*apt)
2024-07-14 03:02:24 +01:00
# Add additional dependencies for apt if needed
2024-07-13 02:57:34 +01:00
;;
*zypper)
2024-07-14 03:02:24 +01:00
# Add additional dependencies for zypper if needed
2024-07-13 02:57:34 +01:00
;;
*dnf)
2024-07-14 03:02:24 +01:00
# Add additional dependencies for dnf if needed
2024-07-13 02:57:34 +01:00
;;
*pacman)
2024-07-14 03:02:24 +01:00
# Add additional dependencies for pacman if needed
2024-07-13 02:57:34 +01:00
;;
*)
2024-07-14 03:02:24 +01:00
# Add additional dependencies for other package managers if needed
2024-07-13 02:57:34 +01:00
;;
esac
}
checkEnv
2024-08-23 14:12:47 +01:00
checkEscalationTool
2024-07-13 02:57:34 +01:00
installDepend
install_additional_dependencies