From 49d46d81cc5ba14d759846f0114405c26d5eb767 Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Thu, 25 Jul 2024 14:12:31 +0200 Subject: [PATCH] Add Nobara --- install.sh | 6 ++-- install/arch/install_required.sh | 2 +- install/fedora/gum.sh | 8 +++++ install/fedora/install_required.sh | 12 ++----- install/includes/checkdistro.sh | 38 +++++++++++++++++++++-- setup.sh | 50 ++++++++++++++++++++++++++---- 6 files changed, 94 insertions(+), 22 deletions(-) create mode 100755 install/fedora/gum.sh diff --git a/install.sh b/install.sh index e6bce7c..a78e9d1 100755 --- a/install.sh +++ b/install.sh @@ -30,12 +30,12 @@ source install/includes/checkdistro.sh # ----------------------------------------------------- # Load Library for used distro # ----------------------------------------------------- -source install/$distro/library.sh +source install/$installer/library.sh # ----------------------------------------------------- # Install required packages # ----------------------------------------------------- -source install/$distro/install_required.sh +source install/$installer/install_required.sh # ----------------------------------------------------- # Confirm Start @@ -50,7 +50,7 @@ source install/includes/preparation.sh # ----------------------------------------------------- # Install Hyprland Packages # ----------------------------------------------------- -source install/$distro/install_packages.sh +source install/$installer/install_packages.sh # ----------------------------------------------------- # Create Backup diff --git a/install/arch/install_required.sh b/install/arch/install_required.sh index 82ca03b..b354a79 100644 --- a/install/arch/install_required.sh +++ b/install/arch/install_required.sh @@ -11,7 +11,7 @@ installer_packages=( "git" ) -echo ":: Installing on Arch" +echo ":: Installing on $distro" # Synchronizing package databases sudo pacman -Sy diff --git a/install/fedora/gum.sh b/install/fedora/gum.sh new file mode 100755 index 0000000..ab7279f --- /dev/null +++ b/install/fedora/gum.sh @@ -0,0 +1,8 @@ +#!/bin/bash +echo '[charm] +name=Charm +baseurl=https://repo.charm.sh/yum/ +enabled=1 +gpgcheck=1 +gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo +sudo yum install gum \ No newline at end of file diff --git a/install/fedora/install_required.sh b/install/fedora/install_required.sh index 720cc84..c063598 100644 --- a/install/fedora/install_required.sh +++ b/install/fedora/install_required.sh @@ -11,20 +11,12 @@ installer_packages=( "git" ) -echo ":: Installing on Fedora" +echo ":: Installing on $distro" _installPackages "${installer_packages[@]}"; # Install gum if [[ $(_isInstalled "gum") == 1 ]]; then - -echo '[charm] -name=Charm -baseurl=https://repo.charm.sh/yum/ -enabled=1 -gpgcheck=1 -gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo -sudo yum install --assumeyes gum - +install/fedora/gum.sh else echo "gum is already installed."; fi diff --git a/install/includes/checkdistro.sh b/install/includes/checkdistro.sh index 55c8dec..8f5ac07 100644 --- a/install/includes/checkdistro.sh +++ b/install/includes/checkdistro.sh @@ -1,23 +1,57 @@ distro="" +installer="" + +# Check for distro if [ -z "$1" ] ;then if [ -f /etc/fedora-release ] ;then distro="fedora" + installer="fedora" fi if [ -f /etc/arch-release ] ;then distro="arch" + installer="arch" + fi + if [ -f /etc/nobara-release ] ;then + distro="nobara" + installer="fedora" fi else + if [[ "$1" == "nobara" ]]; then + distro="nobara" + installer="fedora" + fi if [[ "$1" == "fedora" ]]; then distro="fedora" + installer="fedora" fi if [[ "$1" == "arch" ]]; then distro="arch" + installer="arch" fi fi +# Select installer manually if [ -z $distro ] ;then - echo "ERROR: Your Linux distribution is not supported." - exit + echo "ERROR: Your Linux distribution could not be detected or is not supported." + echo + echo "Please select one of the following installation profiles or cancel the installation." + echo + version=$(gum choose "arch" "fedora" "cancel") + if [ "$version" == "arch" ] ;then + echo ":: Installer for Arch" + distro="arch" + installer="arch" + elif [ "$version" == "rolling-release" ] ;then + echo ":: Installer for Fedora" + distro="fedora" + installer="fedora" + elif [ "$version" == "cancel" ] ;then + echo ":: Setup canceled" + exit 130 + else + echo ":: Setup canceled" + exit 130 + fi fi echo "$distro" > dotfiles/.config/ml4w/settings/distro diff --git a/setup.sh b/setup.sh index 2312641..32462c6 100755 --- a/setup.sh +++ b/setup.sh @@ -4,13 +4,25 @@ # Functions # ----------------------------------------------------- +distro="" +installer="" + # Detect Linux Distribution _detectDistro() { if [ -f /etc/fedora-release ] ;then - echo "fedora" + distro="fedora" + installer="fedora" + echo ":: Installer for Fedora" + fi + if [ -f /etc/nobara-release ] ;then + distro="nobara" + installer="fedora" + echo ":: Installer for Nobara" fi if [ -f /etc/arch-release ] ;then - echo "arch" + distro="arch" + installer="arch" + echo ":: Installer for Arch" fi } @@ -130,22 +142,48 @@ while true; do esac done +# ----------------------------------------------------- +# Detect Distribution +# ----------------------------------------------------- +_detectDistro +if [ -z $distro ] ;then + echo "ERROR: Your Linux distribution could not be detected or is not supported." + echo + echo "Please select one of the following installation profiles or cancel the installation." + echo + version=$(gum choose "arch" "fedora" "cancel") + if [ "$version" == "arch" ] ;then + echo ":: Installer for Arch" + distro="arch" + installer="arch" + elif [ "$version" == "rolling-release" ] ;then + echo ":: Installer for Fedora" + distro="fedora" + installer="fedora" + elif [ "$version" == "cancel" ] ;then + echo ":: Setup canceled" + exit 130 + else + echo ":: Setup canceled" + exit 130 + fi +fi + # ----------------------------------------------------- # Installation for Fedora # ----------------------------------------------------- -if [ $(_detectDistro) == "fedora" ] ;then - echo ":: Installing on Fedora" +if [ "$installer" == "fedora" ] ;then _installPackagesFedora "${installer_packages_fedora[@]}"; fi # ----------------------------------------------------- # Installation for Arch # ----------------------------------------------------- -if [ $(_detectDistro) == "arch" ] ;then - echo ":: Installing on Arch" +if [ "$installer" == "arch" ] ;then _installPackagesPacman "${installer_packages_arch[@]}"; fi +# Create Downloads folder if not exists if [ ! -d ~/Downloads ] ;then mkdir ~/Downloads echo ":: Downloads folder created"