From df8bfc3e7547e9cb5a3bedf99372b31bea70fb66 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Thu, 13 Mar 2025 12:39:54 +0100 Subject: [PATCH] Rework Part 1 --- README.md | 45 +++--- arch-setup.sh | 336 +++++++++++++++++++++++++++++++++++++++++++++ debian-setup.sh | 266 +++++++++++++++++++++++++++++++++++ desktop-setup.sh | 141 +++++++++++++++++++ distrobox-setup.sh | 150 ++++++++++++++++++++ fedora-setup.sh | 1 + setup-distrobox.sh | 60 -------- setup-linux.sh | 127 +---------------- 8 files changed, 924 insertions(+), 202 deletions(-) create mode 100755 arch-setup.sh create mode 100644 debian-setup.sh create mode 100644 desktop-setup.sh create mode 100755 distrobox-setup.sh create mode 100644 fedora-setup.sh delete mode 100644 setup-distrobox.sh diff --git a/README.md b/README.md index 5081269..3a344ff 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,51 @@ +# Linux Scripts -# Linux scripts - -These are my personal scripts to automate stuff related to linux/unix environment. - +These are my personal scripts to automate tasks related to Linux/Unix environments. They help in setting up and configuring various aspects of the system, including package installation, repository setup, and configuration of specific tools and services. ## Documentation -### setup-linux.sh +### setup-linux.sh (Legacy Script) -Allows basic setup of your debian/fedora/arch system with all the basic packages for everyday usage. +This is the legacy script that provides a basic setup for Debian, Fedora, and Arch systems. It includes the installation of essential packages for everyday usage, such as general tools, browsers, everyday apps, gaming-related apps, virtualization/container packages, remote access, U2F (Yubico), terminal/shell, development environment, and OpenRazer. -Includes general tools, browser, everyday apps, gaming related apps, virtualization/container packages, remote access, u2f (yubico), terminal/shell, development environment, openrazer. +### arch-setup.sh -### setup-distrobox.sh +This script is specifically designed for Arch Linux systems. It includes functions to install packages, check and install `whiptail`, add repositories, update the system, set up Pacman configuration, and install various package groups such as Zsh, themes, games, Pipewire, Cups, NetworkManager, Bluetooth, virtualization, containers, U2F, and OpenRGB. It also includes a function to set up browsers and another to configure U2F. -Install preconfigured arch, debian and fedora containers for development. +### debian-setup.sh +This script is tailored for Debian-based systems. It includes functions to install packages, add repositories, update the system, set up Plymouth, and install various package groups such as Zsh, games, Pipewire, Cups, NetworkManager, Bluetooth, virtualization, containers, U2F, and OpenRGB. It also includes a function to set up browsers and another to configure U2F. + +### fedora-setup.sh + +This script is intended for Fedora systems. It is currently a placeholder and will be developed to include similar functionalities as the Arch and Debian setup scripts. + +### desktop-setup.sh + +This script helps in setting up different desktop environments on your system. It detects the distribution and installs the selected desktop environment (GNOME, KDE, XFCE, Cinnamon, MATE, Budgie, Sway, or Hyprland) along with necessary packages. + +### distrobox-setup.sh + +This script installs preconfigured Arch, Debian, and Fedora containers for development using `distrobox`. It checks if `distrobox` is installed, installs it if necessary, and sets up the selected containers. ## Roadmap -- Add desktop/server/minimal setup to setup-linux.sh - -- Add Desktop (gnome/kde/xfce/lxqt...) setup script - - Add Jetbrain setup - +- archinstall alternative +- server-setup.sh ## Contributing Contributions are always welcome! -Open a pull request and we'll discuss on integration of your script or fixes. - +Open a pull request and we'll discuss the integration of your script or fixes. ## FAQ #### What are these scripts for? -Automating task (mostly setup) on most *NIX environment such as desktop or server setup +Automating tasks (mostly setup) on major *NIX environments such as desktop or server setup. -#### I found an issue what should I do? +#### I found an issue, what should I do? -Open an issue with all needed informations so we can fix it or pull request if you found how to fix it. \ No newline at end of file +Open an issue with all the necessary information so we can fix it, or submit a pull request if you have found a solution. \ No newline at end of file diff --git a/arch-setup.sh b/arch-setup.sh new file mode 100755 index 0000000..fee9a26 --- /dev/null +++ b/arch-setup.sh @@ -0,0 +1,336 @@ +#!/bin/bash + +# Function name: Install packages +# Description: Install packages from an array +# Arguments: +# $1: Package list (array) +install_packages() { + local packages=("${!1}") + for package in "${packages[@]}"; do + sudo pacman -S --needed --noconfirm "$package" + done +} + +# Function name: Check whiptail +# Description: Check if whiptail is installed else install it +check_whiptail() { + if ! command -v whiptail &>/dev/null; then + sudo pacman -S --needed --noconfirm libnewt + fi +} + +# Function name: Add repositories +# Description: Ask the user if they want to add specific repositories +add_repositories() { + options=( + "BlackArch" "Add BlackArch repository" OFF + "Chaotic.cx" "Add Chaotic.cx repository" OFF + "CachyOS" "Add CachyOS repository" OFF + ) + + selected_repos=$(whiptail --title "Add Repositories" --checklist \ + "Choose the repositories you want to add:" 20 78 3 \ + "${options[@]}" 3>&1 1>&2 2>&3) + + for repo in $selected_repos; do + case $repo in + "\"BlackArch\"") + if ! grep -q "\[blackarch\]" /etc/pacman.conf; then + curl -O https://blackarch.org/strap.sh + chmod +x strap.sh + sudo sed -i 's/msg '\''installing blackarch-officials meta-package...'\''/#msg '\''installing blackarch-officials meta-package...'\''/' strap.sh + sudo sed -i 's/pacman -S --noconfirm --needed blackarch-officials/#pacman -S --noconfirm --needed blackarch-officials/' strap.sh + sudo ./strap.sh + else + echo "BlackArch repository is already installed." + fi + ;; + "\"Chaotic.cx\"") + if ! grep -q "\[chaotic-aur\]" /etc/pacman.conf; then + sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com + sudo pacman-key --lsign-key 3056513887B78AEB + sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' + sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' + echo '[chaotic-aur]' | sudo tee -a /etc/pacman.conf + echo 'Include = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf + else + echo "Chaotic.cx repository is already installed." + fi + ;; + "\"CachyOS\"") + if ! grep -q "\[cachyos\]" /etc/pacman.conf; then + curl https://mirror.cachyos.org/cachyos-repo.tar.xz -o /tmp/cachyos-repo.tar.xz + tar xvf /tmp/cachyos-repo.tar.xz -C /tmp + cd /tmp/cachyos-repo || exit + sudo ./cachyos-repo.sh + else + echo "CachyOS repository is already installed." + fi +;; +esac + done +} + +# Function name: Update system +# Description: Update the system +update_system() { + sudo pacman -Syu --noconfirm +} + +# Function name: Setup Pacman configuration +# Description: Setup Pacman configuration +setup_pacman() { + sudo sed -i 's/#Color/Color/' /etc/pacman.conf + sudo sed -i 's/#ILoveCandy/ILoveCandy/' /etc/pacman.conf + sudo sed -i 's/#VerbosePkgLists/VerbosePkgLists/' /etc/pacman.conf + sudo sed -i 's/#CheckSpace/CheckSpace/' /etc/pacman.conf + sudo sed -i 's/#PrettyProgressBar/PrettyProgressBar/' /etc/pacman.conf + sudo sed -i 's/#ParallelDownloads = 5/ParallelDownloads = 10/' /etc/pacman.conf + sudo sed -i 's/#DisableDownloadTimeout/DisableDownloadTimeout/' /etc/pacman.conf +} + +# Function name: Setup plymouth +# Description: Setup plymouth +setup_plymouth() { + echo "quiet splash" | sudo tee -a /etc/kernel/cmdline + sudo pacman -S --needed --noconfirm plymouth plymouth-kcm + sudo plymouth-set-default-theme -R catppuccin-mocha +} + +# Packages group definitions +# Package groups +zsh_packages=( + grml-zsh-config + oh-my-zsh-git + zsh + zsh-autosuggestions + zsh-completions + zsh-history-substring-search + zsh-lovers + zsh-syntax-highlighting +) +theme_packages=( + catppuccin-cursors-mocha + catppuccin-gtk-theme-mocha + papirus-folders-catppuccin-git + plymouth-theme-catppuccin-mocha-git + #refind-theme-catppuccin-git + sddm-theme-catppuccin-git +) +games_packages=( + steam-native-runtime + heroic-games-launcher-bin + an-anime-game-launcher-bin + honkers-launcher-bin + sleepy-launcher-bin + the-honkers-railway-launcher-bin + umu-launcher + goverlay + gamemode + gamescope + mangohud +) +pipewire_packages=( + pipewire + pipewire-pulse + pipewire-jack + pipewire-alsa + wireplumber +) +cups_packages=( + cups + cups-pdf + cups-filters + system-config-printer +) +networkmanager_packages=( + networkmanager + networkmanager-openvpn + networkmanager-pptp + networkmanager-vpnc + networkmanager-strongswan + networkmanager-l2tp + wpa_supplicant +) +bluetooth_packages=( + bluez + bluez-utils + bluez-hid2hci + bluedevil +) +virtualization_packages=( + qemu-full + virt-manager + virt-viewer + swtpm +) +containers_packages=( + podman + distrobox + waydroid + lxc +) + +# function name : setup browser +# Description: setup browser +setup_browser() { + options=( + "Firefox" "Install Firefox" ON + "Chromium" "Install Chromium" OFF + "Brave" "Install Brave" OFF + "Vivaldi" "Install Vivaldi" OFF + "Google Chrome" "Install Google Chrome" OFF + "Zen Browser" "Install Zen Browser" OFF + "Tor Browser" "Install Tor Browser" OFF + "Mullvad Browser" "Install Mullvad Browser" OFF + "Edge Stable" "Install Edge Stable" OFF + "LibreWolf" "Install LibreWolf" OFF + "Floorp" "Install Floorp" OFF + "Chromium Widevine" "Install Chromium Widevine" OFF + "Links" "Install Links" OFF + ) + + selected_browsers=$(whiptail --title "Setup Browser" --checklist \ + "Choose the browsers you want to install:" 20 78 13 \ + "${options[@]}" 3>&1 1>&2 2>&3) + + for browser in $selected_browsers; do + case $browser in + "\"Firefox\"") + sudo pacman -S --needed --noconfirm firefox + ;; + "\"Chromium\"") + sudo pacman -S --needed --noconfirm chromium + ;; + "\"Brave\"") + sudo pacman -S --needed --noconfirm brave-bin + ;; + "\"Vivaldi\"") + sudo pacman -S --needed --noconfirm vivaldi + ;; + "\"Google Chrome\"") + yay -S --needed --noconfirm google-chrome + ;; + "\"Zen Browser\"") + yay -S --needed --noconfirm zen-browser-bin + ;; + "\"Tor Browser\"") + sudo pacman -S --needed --noconfirm tor-browser-bin + ;; + "\"Mullvad Browser\"") + yay -S --needed --noconfirm mullvad-browser-bin + ;; + "\"Edge Stable\"") + yay -S --needed --noconfirm microsoft-edge-stable-bin + ;; + "\"LibreWolf\"") + yay -S --needed --noconfirm librewolf + ;; + "\"Floorp\"") + yay -S --needed --noconfirm floorp-bin + ;; + "\"Chromium Widevine\"") + sudo pacman -S --needed --noconfirm chromium-widevine + ;; + "\"Links\"") + sudo pacman -S --needed --noconfirm links + ;; + esac + done +} + +# function name : setup u2f +# Description: setup u2f +setup_u2f() { + sudo pacman -S --needed --noconfirm pam-u2f + mkdir ~/.config/Yubico + pamu2fcfg -o "pam://$HOST" -i "pam://$HOST" > ~/.config/Yubico/u2f_keys + sudo touch /etc/pam.d/u2f-required + sudo touch /etc/pam.d/u2f-sufficient + echo "auth required pam_u2f.so cue origin=pam://$HOST appid=pam://$HOST" | sudo tee -a /etc/pam.d/u2f-required + echo "auth sufficient pam_u2f.so cue origin=pam://$HOST appid=pam://$HOST" | sudo tee -a /etc/pam.d/u2f-sufficient + + sudo sed -i '/^password\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/su + sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/sudo + sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/passwd + sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/system-login + sudo cp /usr/lib/pam.d/polkit-1 /etc/pam.d/polkit-1 + sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/polkit-1 +} + +# function name : setup OpenRGB +# Description: setup OpenRGB +setup_openrgb() { + sudo pacman -S --needed --noconfirm openrgb + sudo gpasswd -a "$USER" plugdev + sudo systemctl enable --now openrgb +} + +# function name : Install packages group +# Description: Install packages group by asking with a selection menu which group would you like to install +install_packages_group() { + options=( + "Zsh" "Install Zsh packages" OFF + "Theme" "Install Theme packages" OFF + "Games" "Install Games packages" OFF + "Pipewire" "Install Pipewire packages" OFF + "Cups" "Install Cups packages" OFF + "NetworkManager" "Install NetworkManager packages" OFF + "Bluetooth" "Install Bluetooth packages" OFF + "Virtualization" "Install Virtualization packages" OFF + "Containers" "Install Containers packages" OFF + "U2F" "Setup U2F" OFF + "OpenRGB" "Setup OpenRGB" OFF + ) + + selected_groups=$(whiptail --title "Install Packages Group" --checklist \ + "Choose the packages group you want to install:" 20 78 11 \ + "${options[@]}" 3>&1 1>&2 2>&3) + + for group in $selected_groups; do + case $group in + "\"Zsh\"") + install_packages zsh_packages[@] + ;; + "\"Theme\"") + install_packages theme_packages[@] + ;; + "\"Games\"") + install_packages games_packages[@] + ;; + "\"Pipewire\"") + install_packages pipewire_packages[@] + ;; + "\"Cups\"") + install_packages cups_packages[@] + ;; + "\"NetworkManager\"") + install_packages networkmanager_packages[@] + ;; + "\"Bluetooth\"") + install_packages bluetooth_packages[@] + ;; + "\"Virtualization\"") + install_packages virtualization_packages[@] + ;; + "\"Containers\"") + install_packages containers_packages[@] + ;; + "\"U2F\"") + setup_u2f + ;; + "\"OpenRGB\"") + setup_openrgb + ;; + esac + done +} + +# Main script +check_whiptail +add_repositories +update_system +setup_pacman +setup_browser +install_packages_group +setup_plymouth \ No newline at end of file diff --git a/debian-setup.sh b/debian-setup.sh new file mode 100644 index 0000000..15491ba --- /dev/null +++ b/debian-setup.sh @@ -0,0 +1,266 @@ +#!/bin/bash + +# Function name: Install packages +# Description: Install packages from an array +# Arguments: +# $1: Package list (array) +install_packages() { + local packages=("${!1}") + for package in "${packages[@]}"; do + sudo apt-get install -y "$package" + done +} + +# Function name: Add repositories +# Description: Add repositories from an array +# Arguments: +# $1: Repository list (array) +add_repositories() { + options=( + "debian" "Debian official repository" ON + "brave" "Brave official repository" OFF + "chrome" "Google Chrome official repository" OFF + "edge" "Microsoft Edge official repository" OFF + "librewolf" "Librewolf official repository" OFF + "mullvad" "Mullvad official repository" OFF + "waydroid" "Waydroid official repository" OFF + ) + + selected_repositories=$(whiptail --title "Add Repositories" --checklist \ + "Choose the repositories you want to add:" 20 78 3 \ + "${options[@]}" 3>&1 1>&2 2>&3) + + for repository in $selected_repositories; do + case $repository in + "debian") + sudo add-apt-repository main + ;; + "brave") + sudo apt install apt-transport-https curl -y + sudo curl -s https://brave-browser-apt-release.s3.brave.com/brave-core.asc | sudo apt-key --keyring /etc/apt/trusted.gpg.d/brave-browser-release.gpg add - + echo "deb [arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list + ;; + "chrome") + wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - + sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list' + ;; + "edge") + curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg + sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ + sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge.list' + ;; + "librewolf") + sudo apt install extrepo -y + sudo extrepo enable librewolf + ;; + "mullvad") + sudo curl -fsSLo /usr/share/keyrings/mullvad-keyring.asc https://repository.mullvad.net/deb/mullvad-keyring.asc + echo "deb [signed-by=/usr/share/keyrings/mullvad-keyring.asc arch=$( dpkg --print-architecture )] https://repository.mullvad.net/deb/stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/mullvad.list + ;; + "waydroid") + sudo apt install curl ca-certificates -y + curl -s https://repo.waydro.id | sudo bash + ;; + esac + done +} + +# Function name: Update system +# Description: Update the system +update_system() { + sudo apt-get update + sudo apt-get upgrade -y +} + +# Function name: Setup plymouth +# Description: Setup plymouth +setup_plymouth() { + sudo apt-get install -y plymouth plymouth-themes + sudo plymouth-set-default-theme -R spinner +} + +# Packages group definitions +zsh_packages=( + zsh + zsh-autosuggestions + zsh-syntax-highlighting +) +games_packages=( + steam-installer +) +pipewire_packages=( + pipewire + pipewire-audio-client-libraries + pipewire-pulse + pipewire-jack + pipewire-alsa + wireplumber +) +cups_packages=( + cups + cups-filters + system-config-printer +) +networkmanager_packages=( + network-manager + network-manager-openvpn + network-manager-pptp + network-manager-vpnc + network-manager-strongswan + network-manager-l2tp + wpasupplicant +) +bluetooth_packages=( + bluez + bluez-tools + blueman +) +virtualization_packages=( + qemu-kvm + libvirt-daemon-system + libvirt-clients + virt-manager + virt-viewer + swtpm +) +containers_packages=( + podman + distrobox + waydroid + lxc +) + +# Function name: Setup browser +# Description: Setup browser +setup_browser() { + options=( + "Firefox" "Install Firefox" ON + "Chromium" "Install Chromium" OFF + "Brave" "Install Brave" OFF + "Google Chrome" "Install Google Chrome" OFF + "Tor Browser" "Install Tor Browser" OFF + "Mullvad Browser" "Install Mullvad Browser" OFF + "Edge Stable" "Install Edge Stable" OFF + "LibreWolf" "Install LibreWolf" OFF + "Links" "Install Links" OFF + ) + + selected_browsers=$(whiptail --title "Setup Browser" --checklist \ + "Choose the browsers you want to install:" 20 78 9 \ + "${options[@]}" 3>&1 1>&2 2>&3) + + for browser in $selected_browsers; do + case $browser in + "\"Firefox\"") + sudo apt-get install -y firefox-esr + ;; + "\"Chromium\"") + sudo apt-get install -y chromium + ;; + "\"Brave\"") + sudo apt-get install -y brave-browser + ;; + "\"Google Chrome\"") + sudo apt-get install -y google-chrome-stable + ;; + "\"Tor Browser\"") + sudo apt-get install -y torbrowser-launcher + ;; + "\"Mullvad Browser\"") + sudo apt-get install -y mullvad-browser + ;; + "\"Edge Stable\"") + sudo apt-get install -y microsoft-edge-stable + ;; + "\"LibreWolf\"") + sudo apt-get install -y librewolf + ;; + "\"Links\"") + sudo apt-get install -y links + ;; + esac + done +} + +# Function name: Setup U2F +# Description: Setup U2F +setup_u2f() { + sudo apt-get install -y libpam-u2f + mkdir -p ~/.config/Yubico + pamu2fcfg > ~/.config/Yubico/u2f_keys + echo "auth required pam_u2f.so" | sudo tee -a /etc/pam.d/common-auth +} + +# Function name: Setup OpenRGB +# Description: Setup OpenRGB +setup_openrgb() { + sudo apt-get install -y openrgb + sudo gpasswd -a "$USER" plugdev + sudo systemctl enable --now openrgb +} + +# Function name: Install packages group +# Description: Install packages group by asking with a selection menu which group would you like to install +install_packages_group() { + options=( + "Zsh" "Install Zsh packages" OFF + "Theme" "Install Theme packages" OFF + "Games" "Install Games packages" OFF + "Pipewire" "Install Pipewire packages" OFF + "Cups" "Install Cups packages" OFF + "NetworkManager" "Install NetworkManager packages" OFF + "Bluetooth" "Install Bluetooth packages" OFF + "Virtualization" "Install Virtualization packages" OFF + "Containers" "Install Containers packages" OFF + "U2F" "Setup U2F" OFF + "OpenRGB" "Setup OpenRGB" OFF + ) + + selected_groups=$(whiptail --title "Install Packages Group" --checklist \ + "Choose the packages group you want to install:" 20 78 11 \ + "${options[@]}" 3>&1 1>&2 2>&3) + + for group in $selected_groups; do + case $group in + "\"Zsh\"") + install_packages zsh_packages[@] + ;; + "\"Theme\"") + install_packages theme_packages[@] + ;; + "\"Games\"") + install_packages games_packages[@] + ;; + "\"Pipewire\"") + install_packages pipewire_packages[@] + ;; + "\"Cups\"") + install_packages cups_packages[@] + ;; + "\"NetworkManager\"") + install_packages networkmanager_packages[@] + ;; + "\"Bluetooth\"") + install_packages bluetooth_packages[@] + ;; + "\"Virtualization\"") + install_packages virtualization_packages[@] + ;; + "\"Containers\"") + install_packages containers_packages[@] + ;; + "\"U2F\"") + setup_u2f + ;; + "\"OpenRGB\"") + setup_openrgb + ;; + esac + done +} + +# Main script +update_system +setup_plymouth +setup_browser +install_packages_group \ No newline at end of file diff --git a/desktop-setup.sh b/desktop-setup.sh new file mode 100644 index 0000000..e631620 --- /dev/null +++ b/desktop-setup.sh @@ -0,0 +1,141 @@ +#!/bin/bash + +# find distro +if command -v lsb_release &>/dev/null; then + DISTRO=$(lsb_release -si | tr '[:upper:]' '[:lower:]') + elif [[ -f /etc/os-release ]]; then + DISTRO=$(source /etc/os-release && echo $ID | tr '[:upper:]' '[:lower:]') +fi + +#function name: check if whiptail is installed +#description: check if whiptail is installed, if not install it +#parameters: none +#return: none +function check_whiptail() { + if ! command -v whiptail &>/dev/null; then + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install whiptail -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf install newt -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed newt --noconfirm + fi + fi +} + +function setupDesktopEnvironment() { + DE=$(whiptail --title "Desktop Environment" --menu "Choose a desktop environment" 15 60 8 \ + "1" "GNOME" \ + "2" "KDE" \ + "3" "XFCE" \ + "4" "Cinnamon" \ + "5" "MATE" \ + "6" "Budgie" \ + "7" "Sway" \ + "8" "Hyprland" 3>&1 1>&2 2>&3) + case $DE in + 1) installGNOME ;; + 2) installKDE ;; + 3) installXFCE ;; + 4) installCinnamon ;; + 5) installMATE ;; + 6) installBudgie ;; + 7) installSway ;; + 8) installHyprland ;; + esac +} + +function installGNOME() { + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install gnome-shell task-gnome-desktop gnome-tweaks gnome-extensions gnome-software-plugin-flatpak -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf group install gnome-desktop -y + sudo dnf in gnome-tweaks gnome-extensions -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed gnome gnome-tweaks gnome-extensions gnome-packagekit --noconfirm + fi +} + +function installKDE() { + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install kde-standard kdeconnect plasma-discover-backend-flatpak -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf group install kde-desktop -y + sudo dnf in kde-connect -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed plasma plasma-meta kdeconnect packagekit-qt6 plymouth-kcm flatpak-kcm sddm-kcm --noconfirm + fi +} + +function installXFCE() { + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install xfce4 xfce4-goodies -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf in @xfce-desktop-environment -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed xfce4 xfce4-goodies --noconfirm + fi +} + +function installCinnamon() { + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install task-cinnamon-desktop -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf in @cinnamon-desktop-environment -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed cinnamon --noconfirm + fi +} + +function installMATE() { + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install mate-desktop-environment -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf in @mate-desktop-environment -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed mate mate-extra --noconfirm + fi +} + +function installBudgie() { + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install --install-suggests budgie-desktop -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf group install budgie-desktop budgie-desktop-apps -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed budgie budgie-desktop --noconfirm + fi +} + +function installSway() { + echo "Warning: Experimental Script." + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install sway swaybg swayidle swaylock waybar xdg-desktop-portal-wlr xwayland -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf in sway-desktop-environment sway swaybg swayidle swaylock waybar -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed sway swaybg swayidle swaylock waybar --noconfirm + fi +} + +function installHyprland() { + echo "Warning: Experimental Script." + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install hyprland -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf in hyprland -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed hyprland --noconfirm + fi +} + +echo -e "\e[1;31mWARNING: This script assumes a standard Debian/Fedora/Arch install.\e[0m" +read -r -p "Are you sure you want to continue? [N/y] " response +if [[ "$response" =~ ^[Yy]$ ]]; then + echo "Continuing..." + check_whiptail + setupDesktopEnvironment +else + echo "Script execution aborted." + exit 1 +fi \ No newline at end of file diff --git a/distrobox-setup.sh b/distrobox-setup.sh new file mode 100755 index 0000000..10f82a6 --- /dev/null +++ b/distrobox-setup.sh @@ -0,0 +1,150 @@ +#!/bin/bash + +# Check if distrobox is installed, if not install it +if ! command -v distrobox &>/dev/null; then + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install distrobox -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf install distrobox -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed distrobox --noconfirm + fi +fi + +# Check if either docker or podman is installed, if none ask the user which one they want to use +if ! command -v podman &>/dev/null && ! command -v docker &>/dev/null; then + CHOICE=$(whiptail --title "Container Engine" --menu "Choose a container engine to install" 15 60 2 \ + "docker" "Docker" \ + "podman" "Podman" 3>&1 1>&2 2>&3) + + case $CHOICE in + docker) + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install docker.io -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf install docker -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed docker --noconfirm + fi + ;; + podman) + if [[ $DISTRO =~ (debian|ubuntu) ]]; then + sudo apt install podman -y + elif [[ $DISTRO == "fedora" ]]; then + sudo dnf install podman -y + elif [[ $DISTRO == "arch" ]]; then + sudo pacman -S --needed podman --noconfirm + fi + ;; + esac +fi + +# Using whiptail checklist ask what container the user wants to setup +OPTIONS=( + "arch" "Arch Linux" off + "debian" "Debian Testing" off + "fedora-rawhide" "Fedora Rawhide" off + "almalinux" "AlmaLinux" off + "opensuse-tumbleweed" "OpenSUSE Tumbleweed" off + "steamos" "SteamOS" off + "void" "Void Linux" off +) +CHOICES=$(whiptail --title "Select Containers" --checklist "Choose the containers you want to setup" 20 78 7 "${OPTIONS[@]}" 3>&1 1>&2 2>&3) + +for CHOICE in $CHOICES; do + CHOICE=$(echo $CHOICE | tr -d '"') + echo No | distrobox rm $CHOICE --force + case $CHOICE in + arch) + if lspci | grep -i nvidia &>/dev/null; then + distrobox-create --yes --name arch \ + --image docker.io/library/archlinux:latest --init --pull --nvidia \ + --home /home/"$USER"/distrobox/arch \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + else + distrobox-create --yes --name arch \ + --image docker.io/library/archlinux:latest --init --pull \ + --home /home/"$USER"/distrobox/arch \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + fi + ;; + debian) + if lspci | grep -i nvidia &>/dev/null; then + distrobox-create --yes --name debian \ + --image docker.io/library/debian:testing --init --pull --nvidia \ + --home /home/"$USER"/distrobox/debian \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + else + distrobox-create --yes --name debian \ + --image docker.io/library/debian:testing --init --pull \ + --home /home/"$USER"/distrobox/debian \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + fi + ;; + fedora-rawhide) + if lspci | grep -i nvidia &>/dev/null; then + distrobox-create --yes --name fedora-rawhide \ + --image registry.fedoraproject.org/fedora:rawhide --init --pull --nvidia \ + --home /home/"$USER"/distrobox/fedora-rawhide \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + else + distrobox-create --yes --name fedora-rawhide \ + --image registry.fedoraproject.org/fedora:rawhide --init --pull \ + --home /home/"$USER"/distrobox/fedora-rawhide \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + fi + ;; + almalinux) + if lspci | grep -i nvidia &>/dev/null; then + distrobox-create --yes --name almalinux \ + --image docker.io/library/almalinux:latest --init --pull --nvidia \ + --home /home/"$USER"/distrobox/almalinux \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + else + distrobox-create --yes --name almalinux \ + --image docker.io/library/almalinux:latest --init --pull \ + --home /home/"$USER"/distrobox/almalinux \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + fi + ;; + opensuse-tumbleweed) + if lspci | grep -i nvidia &>/dev/null; then + distrobox-create --yes --name opensuse-tumbleweed \ + --image registry.opensuse.org/opensuse/distrobox:latest --init --pull --nvidia \ + --home /home/"$USER"/distrobox/opensuse-tumbleweed \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + else + distrobox-create --yes --name opensuse-tumbleweed \ + --image registry.opensuse.org/opensuse/distrobox:latest --init --pull \ + --home /home/"$USER"/distrobox/opensuse-tumbleweed \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + fi + ;; + steamos) + if lspci | grep -i nvidia &>/dev/null; then + distrobox-create --yes --name steamos \ + --image ghcr.io/linuxserver/steamos:latest --init --pull --nvidia \ + --home /home/"$USER"/distrobox/steamos \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + else + distrobox-create --yes --name steamos \ + --image ghcr.io/linuxserver/steamos:latest --init --pull \ + --home /home/"$USER"/distrobox/steamos \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + fi + ;; + void) + if lspci | grep -i nvidia &>/dev/null; then + distrobox-create --yes --name void \ + --image ghcr.io/void-linux/void-musl-full:latest --init --pull --nvidia \ + --home /home/"$USER"/distrobox/void \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + else + distrobox-create --yes --name void \ + --image ghcr.io/void-linux/void-musl-full:latest --init --pull \ + --home /home/"$USER"/distrobox/void \ + --additional-packages "systemd sudo git zsh nano wget curl fastfetch" + fi + ;; + esac +done diff --git a/fedora-setup.sh b/fedora-setup.sh new file mode 100644 index 0000000..cc1f786 --- /dev/null +++ b/fedora-setup.sh @@ -0,0 +1 @@ +#!/bin/bash \ No newline at end of file diff --git a/setup-distrobox.sh b/setup-distrobox.sh deleted file mode 100644 index b1a4de7..0000000 --- a/setup-distrobox.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -if (whiptail --title "Distrobox" --yesno "Should we install Distrobox and Podman?" 8 78); then - if [[ $DISTRO =~ (debian|ubuntu) ]]; then - sudo apt install distrobox podman -y - elif [[ $DISTRO == "fedora" ]]; then - sudo dnf in distrobox podman -y - elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed distrobox podman --noconfirm - fi - if (whiptail --title "Container" --yesno "Should we install all containers?" 8 78); then - - echo No | distrobox rm arch --force - if lspci | grep -i nvidia &>/dev/null; then - distrobox-create --yes --name arch \ - --image docker.io/library/archlinux:latest --init --pull --nvidia \ - --home /home/"$USER"/distrobox/arch \ - --pre-init-hooks "pacman -Sy --needed base-devel sudo git zsh nano wget curl unzip --noconfirm" \ - --init-hooks "curl -sSL https://blackarch.org/strap.sh | sudo bash && sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com && sudo pacman-key --lsign-key 3056513887B78AEB && sudo pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm && echo -e '[chaotic-aur]' | sudo tee -a /etc/pacman.conf && echo -e 'Include = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf && sudo pacman -Sy --needed fastfetch yay --noconfirm" \ - --additional-packages "systemd" - else - distrobox-create --yes --name arch \ - --image docker.io/library/archlinux:latest --init --pull \ - --home /home/"$USER"/distrobox/arch \ - --pre-init-hooks "pacman -Sy --needed base-devel sudo git zsh nano wget curl unzip --noconfirm" \ - --init-hooks "curl -sSL https://blackarch.org/strap.sh | sudo bash && sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com && sudo pacman-key --lsign-key 3056513887B78AEB && sudo pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm && echo -e '[chaotic-aur]' | sudo tee -a /etc/pacman.conf && echo -e 'Include = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf && sudo pacman -Sy --needed fastfetch yay --noconfirm" \ - --additional-packages "systemd" - fi - - echo No | distrobox rm debian --force - if lspci | grep -i nvidia &>/dev/null; then - distrobox-create --yes --name debian \ - --image docker.io/library/debian:testing --init --pull --nvidia \ - --home /home/"$USER"/distrobox/debian \ - --init-hooks "sudo apt update && sudo apt upgrade -y && wget -O ~/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/download/1.12.2/fastfetch-1.12.2-Linux.deb && sudo dpkg -i ~/fastfetch.deb && rm -f ~/fastfetch.deb" \ - --additional-packages "sudo systemd git zsh iproute2 nano wget curl unzip" - else - distrobox-create --yes --name debian \ - --image docker.io/library/debian:testing --init --pull \ - --home /home/"$USER"/distrobox/debian \ - --init-hooks "sudo apt update && sudo apt upgrade -y && wget -O ~/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/download/1.12.2/fastfetch-1.12.2-Linux.deb && sudo dpkg -i ~/fastfetch.deb && rm -f ~/fastfetch.deb" \ - --additional-packages "sudo systemd git zsh iproute2 nano wget curl unzip" - fi - - echo No | distrobox rm fedora-rawhide --force - if lspci | grep -i nvidia &>/dev/null; then - distrobox-create --yes --name fedora-rawhide \ - --image registry.fedoraproject.org/fedora:rawhide --init --pull --nvidia \ - --home /home/"$USER"/distrobox/fedora-rawhide \ - --init-hooks "sudo dnf 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" \ - --additional-packages "sudo systemd git zsh fastfetch nano wget curl unzip" - else - distrobox-create --yes --name fedora-rawhide \ - --image registry.fedoraproject.org/fedora:rawhide --init --pull \ - --home /home/"$USER"/distrobox/fedora-rawhide \ - --init-hooks "sudo dnf 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" \ - --additional-packages "sudo systemd git zsh fastfetch nano wget curl unzip" - fi - fi -fi \ No newline at end of file diff --git a/setup-linux.sh b/setup-linux.sh index 1c6c290..67af577 100755 --- a/setup-linux.sh +++ b/setup-linux.sh @@ -3,19 +3,6 @@ # global var DISTRO="" -export NEWT_COLORS=" -root=,green -window=,black -shadow=,green -border=green,black -title=green,black -textbox=green,black -radiolist=black,black -label=black,green -checkbox=black,green -compactbutton=black,green -button=black,red" - function getDistributionType() { echo "Detecting distribution..." if [[ -e /etc/debian_version ]]; then @@ -44,7 +31,7 @@ function checkWhiptail() { elif [[ $DISTRO == "fedora" ]]; then sudo dnf in newt -y elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed --noconfirm newt + sudo pacman -S --needed --noconfirm libnewt fi fi echo "Whiptail installed." @@ -338,11 +325,11 @@ function setupU2F() { sudo pacman -S --needed yubico-pam yubikey-full-disk-encryption yubikey-manager-qt yubikey-personalization yubikey-personalization-gui yubikey-touch-detector yubioath-desktop --noconfirm fi mkdir ~/.config/Yubico - pamu2fcfg -o pam://$HOSTNAME -i pam://$HOSTNAME > ~/.config/Yubico/u2f_keys + pamu2fcfg -o pam://$HOST -i pam://$HOST > ~/.config/Yubico/u2f_keys sudo touch /etc/pam.d/u2f-required sudo touch /etc/pam.d/u2f-sufficient - echo -e "#%PAM-1.0\nauth required pam_u2f.so cue origin=pam://$HOSTNAME appid=pam://$HOSTNAME" | sudo tee /etc/pam.d/u2f-required - echo -e "#%PAM-1.0\nauth sufficient pam_u2f.so cue origin=pam://$HOSTNAME appid=pam://$HOSTNAME" | sudo tee /etc/pam.d/u2f-sufficient + echo -e "#%PAM-1.0\nauth required pam_u2f.so cue origin=pam://$HOST appid=pam://$HOST" | sudo tee /etc/pam.d/u2f-required + echo -e "#%PAM-1.0\nauth sufficient pam_u2f.so cue origin=pam://$HOST appid=pam://$HOST" | sudo tee /etc/pam.d/u2f-sufficient fi } @@ -416,112 +403,6 @@ function installSoftware() { fi } -function setupDesktopEnvironment() { - DE=$(whiptail --title "Desktop Environment" --menu "Choose a desktop environment" 15 60 8 \ - "1" "GNOME" \ - "2" "KDE" \ - "3" "XFCE" \ - "4" "Cinnamon" \ - "5" "MATE" \ - "6" "Budgie" \ - "7" "Sway" \ - "8" "Hyprland" 3>&1 1>&2 2>&3) - case $DE in - 1) installGNOME ;; - 2) installKDE ;; - 3) installXFCE ;; - 4) installCinnamon ;; - 5) installMATE ;; - 6) installBudgie ;; - 7) installSway ;; - 8) installHyprland ;; - esac -} - -function installGNOME() { - if [[ $DISTRO =~ (debian|ubuntu) ]]; then - sudo apt install gnome-shell task-gnome-desktop gnome-tweaks gnome-extensions gnome-software-plugin-flatpak -y - elif [[ $DISTRO == "fedora" ]]; then - sudo dnf group install gnome-desktop -y - sudo dnf in gnome-tweaks gnome-extensions -y - elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed gnome gnome-tweaks gnome-extensions gnome-packagekit --noconfirm - fi -} - -function installKDE() { - if [[ $DISTRO =~ (debian|ubuntu) ]]; then - sudo apt install kde-standard kdeconnect plasma-discover-backend-flatpak -y - elif [[ $DISTRO == "fedora" ]]; then - sudo dnf group install kde-desktop -y - sudo dnf in kde-connect -y - elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed plasma plasma-meta kdeconnect packagekit-qt6 plymouth-kcm flatpak-kcm sddm-kcm --noconfirm - fi -} - -function installXFCE() { - if [[ $DISTRO =~ (debian|ubuntu) ]]; then - sudo apt install xfce4 xfce4-goodies -y - elif [[ $DISTRO == "fedora" ]]; then - sudo dnf in @xfce-desktop-environment -y - elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed xfce4 xfce4-goodies --noconfirm - fi -} - -function installCinnamon() { - if [[ $DISTRO =~ (debian|ubuntu) ]]; then - sudo apt install task-cinnamon-desktop -y - elif [[ $DISTRO == "fedora" ]]; then - sudo dnf in @cinnamon-desktop-environment -y - elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed cinnamon --noconfirm - fi -} - -function installMATE() { - if [[ $DISTRO =~ (debian|ubuntu) ]]; then - sudo apt install mate-desktop-environment -y - elif [[ $DISTRO == "fedora" ]]; then - sudo dnf in @mate-desktop-environment -y - elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed mate mate-extra --noconfirm - fi -} - -function installBudgie() { - if [[ $DISTRO =~ (debian|ubuntu) ]]; then - sudo apt install --install-suggests budgie-desktop -y - elif [[ $DISTRO == "fedora" ]]; then - sudo dnf group install budgie-desktop budgie-desktop-apps -y - elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed budgie budgie-desktop --noconfirm - fi -} - -function installSway() { - echo "Warning: Experimental Script." - if [[ $DISTRO =~ (debian|ubuntu) ]]; then - sudo apt install sway swaybg swayidle swaylock waybar xdg-desktop-portal-wlr xwayland -y - elif [[ $DISTRO == "fedora" ]]; then - sudo dnf in sway-desktop-environment sway swaybg swayidle swaylock waybar -y - elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed sway swaybg swayidle swaylock waybar --noconfirm - fi -} - -function installHyprland() { - echo "Warning: Experimental Script." - if [[ $DISTRO =~ (debian|ubuntu) ]]; then - sudo apt install hyprland -y - elif [[ $DISTRO == "fedora" ]]; then - sudo dnf in hyprland -y - elif [[ $DISTRO == "arch" ]]; then - sudo pacman -S --needed hyprland --noconfirm - fi -} - function setupDomainMember() { echo "Warning: Experimental Script." if (whiptail --title "Samba" --yesno "Should we install Samba?" 8 78); then