From 27941dbc48b2aa542b6c80d02a4a6fd3e65ee068 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Sat, 14 Sep 2024 17:29:55 +0200 Subject: [PATCH 1/4] Refactored + removed bashisms - revieved all packages - changed the structure to have synergy with other scripts - updated dnf & zypper commands - added nala --- tabs/system-setup/2-gaming-setup.sh | 131 +++++++++++++++------------- 1 file changed, 69 insertions(+), 62 deletions(-) diff --git a/tabs/system-setup/2-gaming-setup.sh b/tabs/system-setup/2-gaming-setup.sh index ce52aea2d..96798a622 100755 --- a/tabs/system-setup/2-gaming-setup.sh +++ b/tabs/system-setup/2-gaming-setup.sh @@ -3,35 +3,59 @@ . ../common-script.sh installDepend() { - ## Check for dependencies. - echo -e "${YELLOW}Installing dependencies...${RC}" - if [ "$PACKAGER" = "pacman" ]; then - if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then - 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 - else - echo "Multilib is already enabled." - fi - $AUR_HELPER -S --needed --noconfirm wine giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls \ -mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error \ -lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo \ -sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama \ -ncurses lib32-ncurses ocl-icd lib32-ocl-icd libxslt lib32-libxslt libva lib32-libva gtk3 \ -lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader - elif [ "$PACKAGER" = "apt-get" ]; then - $ESCALATION_TOOL ${PACKAGER} update - $ESCALATION_TOOL ${PACKAGER} install -y wine64 wine32 libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386 - elif [ "$PACKAGER" = "dnf" ] || [ "$PACKAGER" = "zypper" ]; then - $ESCALATION_TOOL ${PACKAGER} install -y wine - else - $ESCALATION_TOOL ${PACKAGER} install -y ${DEPENDENCIES} - fi + # Check for dependencies + DEPENDENCIES='wine dbus' + printf "%b\n" "${YELLOW}Installing dependencies...${RC}" + case "$PACKAGER" in + pacman) + #Check for multilib + if ! grep -q "^\s*$$multilib$$" /etc/pacman.conf; then + 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 + else + echo "Multilib is already enabled." + fi + + DISTRO_DEPS="gnutls lib32-gnutls base-devel gtk2 gtk3 lib32-gtk2 lib32-gtk3 libpulse lib32-libpulse alsa-lib lib32-alsa-lib \ + alsa-utils alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib giflib lib32-giflib libpng lib32-libpng \ + libldap lib32-libldap openal lib32-openal libxcomposite lib32-libxcomposite libxinerama lib32-libxinerama \ + ncurses lib32-ncurses vulkan-icd-loader lib32-vulkan-icd-loader ocl-icd lib32-ocl-icd libva lib32-libva \ + gst-plugins-base-libs lib32-gst-plugins-base-libs sdl2" + + $AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES" $DISTRO_DEPS + ;; + apt-get|nala) + DISTRO_DEPS="libasound2 libsdl2 wine64 wine32" + + $ESCALATION_TOOL "$PACKAGER" update + $ESCALATION_TOOL dpkg --add-architecture i386 + $ESCALATION_TOOL "$PACKAGER" install -y software-properties-common + $ESCALATION_TOOL apt-add-repository contrib -y + $ESCALATION_TOOL "$PACKAGER" update + $ESCALATION_TOOL "$PACKAGER" install -y "$DEPENDENCIES" $DISTRO_DEPS + ;; + dnf) + $ESCALATION_TOOL "$PACKAGER" install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm -y + $ESCALATION_TOOL "$PACKAGER" config-manager --enable fedora-cisco-openh264 -y + $ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES + ;; + zypper) + $ESCALATION_TOOL "$PACKAGER" -n install $DEPENDENCIES + ;; + *) + $ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES + ;; + esac } -install_additional_dependencies() { - case $(command -v apt-get || command -v zypper || command -v dnf || command -v pacman) in - *apt-get) +installAdditionalDepend() { + case "$PACKAGER" in + pacman) + DISTRO_DEPS='steam lutris goverlay' + $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS + ;; + apt-get|nala) version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris | grep -v 'beta' | tail -n1 | @@ -40,10 +64,10 @@ install_additional_dependencies() { version_no_v=$(echo "$version" | tr -d v) wget "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb" - # Install the downloaded .deb package using apt-get + # Install the downloaded .deb echo "Installing lutris_${version_no_v}_all.deb" - $ESCALATION_TOOL apt-get update - $ESCALATION_TOOL apt-get install ./lutris_${version_no_v}_all.deb + $ESCALATION_TOOL "$PACKAGER" update + $ESCALATION_TOOL "$PACKAGER" install ./lutris_${version_no_v}_all.deb # Clean up the downloaded .deb file rm lutris_${version_no_v}_all.deb @@ -51,44 +75,27 @@ install_additional_dependencies() { echo "Lutris Installation complete." echo "Installing steam..." - #Install steam on Debian - if (lsb_release -i | grep -qi Debian); then - #Enable i386 repos - $ESCALATION_TOOL dpkg --add-architecture i386 - # Install software-properties-common to be able to add repos - $ESCALATION_TOOL apt-get install -y software-properties-common - # Add repos necessary for installing steam - $ESCALATION_TOOL apt-add-repository contrib -y + # Install steam on Debian + if lsb_release -i | grep -qi Debian; then $ESCALATION_TOOL apt-add-repository non-free -y - #Install steam - $ESCALATION_TOOL apt-get install steam-installer -y + # Install steam + $ESCALATION_TOOL "$PACKAGER" install steam-installer -y else - #Install steam on Ubuntu - $ESCALATION_TOOL apt-get install -y steam + # Install steam on Ubuntu + $ESCALATION_TOOL "$PACKAGER" install -y steam fi ;; - *zypper) - + dnf) + DISTRO_DEPS='steam lutris' + $ESCALATION_TOOL "$PACKAGER" install -y $DISTRO_DEPS ;; - *dnf) - - ;; - *pacman) - echo "Installing Steam for Arch Linux..." - $ESCALATION_TOOL pacman -S --needed --noconfirm steam - echo "Steam installation complete." - - echo "Installing Lutris for Arch Linux..." - $ESCALATION_TOOL pacman -S --needed --noconfirm lutris - echo "Lutris installation complete." - - echo "Installing GOverlay for Arch Linux..." - $ESCALATION_TOOL pacman -S --needed --noconfirm goverlay - echo "GOverlay installation complete." + zypper) + # Flatpak?? + DISTRO_DEPS='lutris' + $ESCALATION_TOOL "$PACKAGER" -n install $DISTRO_DEPS ;; *) - - ;; + ;; esac } @@ -96,4 +103,4 @@ checkEnv checkAURHelper checkEscalationTool installDepend -install_additional_dependencies \ No newline at end of file +installAdditionalDepend \ No newline at end of file From 4b1c72d53d96abaf6b44a77b517644c931063d69 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Tue, 17 Sep 2024 13:45:49 +0200 Subject: [PATCH 2/4] use apt-get instead of apt Co-authored-by: Nyx <144965845+nnyyxxxx@users.noreply.github.com> --- tabs/system-setup/2-gaming-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tabs/system-setup/2-gaming-setup.sh b/tabs/system-setup/2-gaming-setup.sh index 8df5a8bbf..e43c59897 100755 --- a/tabs/system-setup/2-gaming-setup.sh +++ b/tabs/system-setup/2-gaming-setup.sh @@ -25,7 +25,7 @@ installDepend() { $AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES" $DISTRO_DEPS ;; - apt-get|nala) + apt|nala) DISTRO_DEPS="libasound2 libsdl2 wine64 wine32" $ESCALATION_TOOL "$PACKAGER" update From de8657cd7e158f672a7dced4490867e0058e9581 Mon Sep 17 00:00:00 2001 From: Nyx <144965845+nnyyxxxx@users.noreply.github.com> Date: Tue, 17 Sep 2024 07:52:24 -0400 Subject: [PATCH 3/4] small refactor (#3) Co-authored-by: nnyyxxxx --- tabs/system-setup/2-gaming-setup.sh | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tabs/system-setup/2-gaming-setup.sh b/tabs/system-setup/2-gaming-setup.sh index e43c59897..0a8b74c0b 100755 --- a/tabs/system-setup/2-gaming-setup.sh +++ b/tabs/system-setup/2-gaming-setup.sh @@ -14,7 +14,7 @@ installDepend() { echo "Include = /etc/pacman.d/mirrorlist" | $ESCALATION_TOOL tee -a /etc/pacman.conf $ESCALATION_TOOL "$PACKAGER" -Syu else - echo "Multilib is already enabled." + printf "%b\n" "${GREEN}Multilib is already enabled.${RC}" fi DISTRO_DEPS="gnutls lib32-gnutls base-devel gtk2 gtk3 lib32-gtk2 lib32-gtk3 libpulse lib32-libpulse alsa-lib lib32-alsa-lib \ @@ -55,7 +55,7 @@ installAdditionalDepend() { DISTRO_DEPS='steam lutris goverlay' $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS ;; - apt-get|nala) + apt|nala) version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris | grep -v 'beta' | tail -n1 | @@ -64,24 +64,19 @@ installAdditionalDepend() { version_no_v=$(echo "$version" | tr -d v) curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb" - # Install the downloaded .deb package - echo "Installing lutris_${version_no_v}_all.deb" + printf "%b\n" "${YELLOW}Installing Lutris...${RC}" $ESCALATION_TOOL "$PACKAGER" update $ESCALATION_TOOL "$PACKAGER" install ./lutris_${version_no_v}_all.deb - # Clean up the downloaded .deb file rm lutris_${version_no_v}_all.deb - echo "Lutris Installation complete." - echo "Installing steam..." + printf "%b\n" "${GREEN}Lutris Installation complete.${RC}" + printf "%b\n" "${YELLOW}Installing steam...${RC}" - # Install steam on Debian if lsb_release -i | grep -qi Debian; then $ESCALATION_TOOL apt-add-repository non-free -y - # Install steam $ESCALATION_TOOL "$PACKAGER" install steam-installer -y else - # Install steam on Ubuntu $ESCALATION_TOOL "$PACKAGER" install -y steam fi ;; @@ -90,7 +85,7 @@ installAdditionalDepend() { $ESCALATION_TOOL "$PACKAGER" install -y $DISTRO_DEPS ;; zypper) - # Flatpak?? + # Flatpak DISTRO_DEPS='lutris' $ESCALATION_TOOL "$PACKAGER" -n install $DISTRO_DEPS ;; @@ -103,4 +98,4 @@ checkEnv checkAURHelper checkEscalationTool installDepend -installAdditionalDepend +installAdditionalDepend \ No newline at end of file From 1259ca85068ddbb3d5995ed5d6ac87bbdb985ead Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Wed, 18 Sep 2024 21:07:21 +0200 Subject: [PATCH 4/4] apt-get + quote escalation --- tabs/system-setup/2-gaming-setup.sh | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/tabs/system-setup/2-gaming-setup.sh b/tabs/system-setup/2-gaming-setup.sh index 0a8b74c0b..f414928fa 100755 --- a/tabs/system-setup/2-gaming-setup.sh +++ b/tabs/system-setup/2-gaming-setup.sh @@ -10,9 +10,9 @@ installDepend() { pacman) #Check for multilib if ! grep -q "^\s*$$multilib$$" /etc/pacman.conf; then - 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 + 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 else printf "%b\n" "${GREEN}Multilib is already enabled.${RC}" fi @@ -25,26 +25,26 @@ installDepend() { $AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES" $DISTRO_DEPS ;; - apt|nala) + apt-get|nala) DISTRO_DEPS="libasound2 libsdl2 wine64 wine32" - $ESCALATION_TOOL "$PACKAGER" update - $ESCALATION_TOOL dpkg --add-architecture i386 - $ESCALATION_TOOL "$PACKAGER" install -y software-properties-common - $ESCALATION_TOOL apt-add-repository contrib -y - $ESCALATION_TOOL "$PACKAGER" update - $ESCALATION_TOOL "$PACKAGER" install -y "$DEPENDENCIES" $DISTRO_DEPS + "$ESCALATION_TOOL" "$PACKAGER" update + "$ESCALATION_TOOL" dpkg --add-architecture i386 + "$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common + "$ESCALATION_TOOL" apt-add-repository contrib -y + "$ESCALATION_TOOL" "$PACKAGER" update + "$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES" $DISTRO_DEPS ;; dnf) - $ESCALATION_TOOL "$PACKAGER" install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm -y - $ESCALATION_TOOL "$PACKAGER" config-manager --enable fedora-cisco-openh264 -y - $ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES + "$ESCALATION_TOOL" "$PACKAGER" install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm -y + "$ESCALATION_TOOL" "$PACKAGER" config-manager --enable fedora-cisco-openh264 -y + "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES ;; zypper) - $ESCALATION_TOOL "$PACKAGER" -n install $DEPENDENCIES + "$ESCALATION_TOOL" "$PACKAGER" -n install $DEPENDENCIES ;; *) - $ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES + "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES ;; esac } @@ -53,9 +53,9 @@ installAdditionalDepend() { case "$PACKAGER" in pacman) DISTRO_DEPS='steam lutris goverlay' - $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS ;; - apt|nala) + apt-get|nala) version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris | grep -v 'beta' | tail -n1 | @@ -65,8 +65,8 @@ installAdditionalDepend() { curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb" printf "%b\n" "${YELLOW}Installing Lutris...${RC}" - $ESCALATION_TOOL "$PACKAGER" update - $ESCALATION_TOOL "$PACKAGER" install ./lutris_${version_no_v}_all.deb + "$ESCALATION_TOOL" "$PACKAGER" update + "$ESCALATION_TOOL" "$PACKAGER" install ./lutris_${version_no_v}_all.deb rm lutris_${version_no_v}_all.deb @@ -74,20 +74,20 @@ installAdditionalDepend() { printf "%b\n" "${YELLOW}Installing steam...${RC}" if lsb_release -i | grep -qi Debian; then - $ESCALATION_TOOL apt-add-repository non-free -y - $ESCALATION_TOOL "$PACKAGER" install steam-installer -y + "$ESCALATION_TOOL" apt-add-repository non-free -y + "$ESCALATION_TOOL" "$PACKAGER" install steam-installer -y else - $ESCALATION_TOOL "$PACKAGER" install -y steam + "$ESCALATION_TOOL" "$PACKAGER" install -y steam fi ;; dnf) DISTRO_DEPS='steam lutris' - $ESCALATION_TOOL "$PACKAGER" install -y $DISTRO_DEPS + "$ESCALATION_TOOL" "$PACKAGER" install -y $DISTRO_DEPS ;; zypper) # Flatpak DISTRO_DEPS='lutris' - $ESCALATION_TOOL "$PACKAGER" -n install $DISTRO_DEPS + "$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS ;; *) ;; @@ -98,4 +98,4 @@ checkEnv checkAURHelper checkEscalationTool installDepend -installAdditionalDepend \ No newline at end of file +installAdditionalDepend