diff --git a/LazyVim.sh b/LazyVim.sh index a6d5bf8..6d404c8 100755 --- a/LazyVim.sh +++ b/LazyVim.sh @@ -1,5 +1,13 @@ #!/usr/bin/bash +# Detect fish shell and ask user to switch to bash (bash-only syntax) +if [ -n "${FISH_VERSION:-}" ] || case "$SHELL" in *fish*) ;; *) false ;; esac; then + echo "Warning: fish shell detected." + echo "This script is written for bash and may have syntax issues under fish." + echo "Please switch to bash first and re-run it, e.g.: bash $0" + read -r -p "Press Enter to continue anyway, or Ctrl+C to cancel..." /dev/null; then echo "Cannot proceed: Not a arch based system" echo "This script does not have debian support" diff --git a/README.md b/README.md index 862b67e..c9f58be 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Single-install-script This script automatically installs my favourite Linux applications I use every day such as: -[Docker](https://www.docker.com/), [zsh, oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) and [neovim](https://neovim.io/). This uses pacman and [yay AUR helper](https://github.com/Jguer/yay). You can choose what sections to install with the whiptail menu. +[Docker](https://www.docker.com/), [zsh, oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) and [neovim](https://neovim.io/). This uses the [shelly-cli](https://github.com/Seafoam-Labs/Shelly-ALPM) package manager. You can choose what sections to install with the whiptail menu. -This script will use aim to use the [shelly-cli](https://github.com/Seafoam-Labs/Shelly-ALPM) installer. +This script will automatically install [shelly-cli](https://github.com/Seafoam-Labs/Shelly-ALPM) if it is not already present. Most of this script is intended for Arch Linux with some Debian compatibility on the zsh install script only. diff --git a/SecureBoot.sh b/SecureBoot.sh index 627314b..939b8aa 100755 --- a/SecureBoot.sh +++ b/SecureBoot.sh @@ -1,3 +1,13 @@ +#!/usr/bin/bash + +# Detect fish shell and ask user to switch to bash (bash-only syntax) +if [ -n "${FISH_VERSION:-}" ] || case "$SHELL" in *fish*) ;; *) false ;; esac; then + echo "Warning: fish shell detected." + echo "This script is written for bash and may have syntax issues under fish." + echo "Please switch to bash first and re-run it, e.g.: bash $0" + read -r -p "Press Enter to continue anyway, or Ctrl+C to cancel..." /dev/null; then - echo "pacman detected. Installing prerequisites" - sudo pacman -Syu git zsh curl wget whiptail --noconfirm --needed + # Install build prerequisites for shelly + if ! sudo pacman -S --needed --noconfirm base-devel git; then + echo "--------------------------------------------------------------------" + echo "Failed to install prerequisite packages for Shelly. You can try running it manually:" + echo "sudo pacman -S --needed --noconfirm base-devel git" + echo "--------------------------------------------------------------------" + exit 1 # exit with an error + fi + # Check if shelly binary exists + if ! command -v shelly >/dev/null; then + echo "shelly is NOT installed. Running installation commands..." + if ! git clone https://aur.archlinux.org/shelly.git /tmp/shelly_install; then + echo "--------------------------------------------------------------------" + echo "Failed to clone shelly repository. You can try running it manually:" + echo "git clone https://aur.archlinux.org/shelly.git /tmp/shelly_install" + echo "--------------------------------------------------------------------" + exit 1 # exit with an error + elif ! (cd /tmp/shelly_install && makepkg -si --noconfirm); then + echo "--------------------------------------------------------------------" + echo "Failed to build and install shelly. You can try running it manually:" + echo "cd /tmp/shelly_install && makepkg -si --noconfirm" + echo "--------------------------------------------------------------------" + exit 1 # exit with an error + fi + cd "$PreviousWD" + rm -rf /tmp/shelly_install + else + echo "Shelly is already installed." + fi +fi + +# Install prerequisites +if command -v shelly >/dev/null; then + echo "shelly detected. Installing prerequisites" + shelly install standard git zsh curl wget libnewt rsync whiptail --upgrade --no-confirm fi if command -v apt >/dev/null; then echo "apt detected. Installing prerequisites" sudo apt update sudo apt full-upgrade -y - sudo apt install git zsh curl wget whiptail -y + sudo apt install git zsh curl wget whiptail rsync -y fi # Ensure whiptail is installed if ! command -v whiptail >/dev/null; then echo "whiptail is not installed. Installing it now..." - if command -v pacman >/dev/null; then - echo "pacman detected. Installing prerequisites" - sudo pacman -S whiptail --noconfirm || { + if command -v shelly >/dev/null; then + echo "shelly detected. Installing whiptail" + shelly install standard whiptail --no-confirm || { echo "Failed to install whiptail. Exiting." exit 1 } - # Reload zsh if it exists - if command -v zsh -h >/dev/null; then - source ~/.zshrc - fi - # Reload Bash - source ~/.bashrc fi if command -v apt >/dev/null; then - echo "apt detected. Installing prerequisites" + echo "apt detected. Installing whiptail" sudo apt install whiptail -y || { echo "Failed to install whiptail. Exiting." exit 1 } - # Reload zsh if it exists - if command -v zsh -h >/dev/null; then - source ~/.zshrc - fi - # Reload Bash - source ~/.bashrc fi fi # Options for the whiptail menu OPTIONS=( - 1 "Run zsh setup script" ON - 2 "Run LazyVim setup script" OFF - 3 "Install Docker" OFF - 4 "Install Pacman Packages" ON - 5 "Install Yay and AUR Packages" ON - 6 "Install affinity with GUI" OFF + 1 "Run zsh setup script" OFF + 2 "Run fish setup script" ON + 3 "Run LazyVim setup script" OFF + 4 "Install Docker" OFF + 5 "Install Standard Packages (Shelly)" ON + 6 "Install AUR Packages (Shelly)" ON + 7 "Install affinity with GUI" OFF ) CHOICE=$(whiptail --title "Installation Options" --checklist \ @@ -108,7 +136,7 @@ set -eu pipefail # Process selected options for selection in $CHOICE; do - clean_selection=$(echo "$selection " | tr -d '"') + clean_selection=$(echo "$selection" | tr -d '"') case $clean_selection in "1") echo "Running zsh setup script..." @@ -121,6 +149,16 @@ for selection in $CHOICE; do fi ;; "2") + echo "Running fish setup script..." + # Runs local script unless it does not exist or fails + if [[ -f "fish.sh" ]]; then + echo "Found local script, running..." + bash fish.sh --skip-watermark + else + bash "$(curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/fish.sh)" --skip-watermark + fi + ;; + "3") echo "Running LazyVim setup script..." # Runs local script unless it does not exist or fails if [[ -f "LazyVim.sh" ]]; then @@ -130,7 +168,7 @@ for selection in $CHOICE; do curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/LazyVim.sh | bash fi ;; - "3") + "4") echo "Installing Docker..." if ! command -v docker >/dev/null; then echo "docker is NOT installed. Installing..." @@ -142,86 +180,69 @@ for selection in $CHOICE; do echo "+ sleep 10" && sleep 10 fi ;; - "4") - echo "Installing Pacman Packages..." - # Check if pacman binary is installed - if command -v pacman /dev/null; then + echo "Cannot proceed: shelly binary not found" exit 1 # exit with an error fi - # Install pacman packages - # Runs local script unless it does not exit or fails - if [[ -f "./configs/PackagesPacman.txt" ]]; then - echo "Found local config" - cat ./configs/PackagesPacman.txt | sudo pacman -S - --needed --noconfirm - elif ! curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesPacman.txt | sudo pacman -S - --needed --noconfirm; then + # Install standard packages from shelly backup + # Runs local script unless it does not exist or fails + if [[ -f "./configs/shelly-standard.toml" ]]; then + echo "Found local backup" + shelly backup --import --name shelly-standard --directory ./configs --no-confirm + elif ! curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/shelly-standard.toml -o /tmp/shelly-standard.toml; then echo "--------------------------------------------------------------------" - echo "Failed to install Pacman packages. You can try running it manually:" - echo "curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesPacman.txt | sudo pacman -S - --needed --noconfirm" + echo "Failed to download shelly backup. You can try running it manually:" + echo "curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/shelly-standard.toml -o /tmp/shelly-standard.toml" echo "--------------------------------------------------------------------" echo "+ sleep 10" && sleep 10 - fi - ;; - "5") - echo "Installing Yay and Yay Packages..." - # Check for pacman before installing yay - if command -v pacman /dev/null; then - echo "yay is NOT installed. Running installation commands..." - if ! git clone https://aur.archlinux.org/yay.git /tmp/yay_install; then - echo "--------------------------------------------------------------------" - echo "Failed to clone yay repository. You can try running it manually:" - echo "git clone https://aur.archlinux.org/yay.git /tmp/yay_install" - echo "--------------------------------------------------------------------" - exit 1 # exit with an error - elif ! (cd /tmp/yay_install && makepkg -si --noconfirm); then - echo "--------------------------------------------------------------------" - echo "Failed to build and install yay. You can try running it manually:" - echo "cd /tmp/yay_install && makepkg -si --noconfirm" - echo "--------------------------------------------------------------------" - exit 1 # exit with an error - fi - cd "$PreviousWD" - rm -rf /tmp/yay_install - else - echo "Yay is already installed." - fi - # Install yay packages - # Runs local script unless it does no exist or fails - if [[ -f "./config/PackagesYay.txt" ]]; then - echo "Found local config" - cat ./config/PackagesYay.txt | yay -S --needed --save --answerclean None --answerdiff None - --noconfirm - elif ! curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesYay.txt | yay -S --needed --save --answerclean None --answerdiff None - --noconfirm; then - echo "--------------------------------------------------------------------" - echo "Failed to install Yay packages. You can try running it manually:" - echo "curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesYay.txt | yay -S --needed --save --answerclean None --answerdiff None - --noconfirm" + echo "Failed to install Standard packages. You can try running it manually:" + echo "shelly backup --import --name shelly-standard --directory /tmp --no-confirm" echo "--------------------------------------------------------------------" echo "+ sleep 10" && sleep 10 fi ;; "6") - echo "Installing GUI dependencies" - if command -v pacman /dev/null; then + echo "Cannot proceed: shelly binary not found" + exit 1 # Exit with an error fi - if command -v dnf /dev/null; then + echo "shelly found" + shelly install standard python-pyqt6 --no-confirm + fi + if command -v dnf >/dev/null; then echo "dnf found" sudo dnf install python3-pyqt6 fi - if command -v apt /dev/null; then echo "apt found" sudo apt install python3-pyqt6 -y fi diff --git a/installbeta.sh b/installbeta.sh index 7bab454..2b72323 100755 --- a/installbeta.sh +++ b/installbeta.sh @@ -3,12 +3,20 @@ PreviousWD=$(pwd) skip_watermark=false if [ "$1" = "--skip-watermark" ]; then - skip_watermark=true + skip_watermark=true +fi + +# Detect fish shell and ask user to switch to bash (bash-only syntax) +if [ -n "${FISH_VERSION:-}" ] || case "$SHELL" in *fish*) ;; *) false ;; esac; then + echo "Warning: fish shell detected." + echo "This script is written for bash and may have syntax issues under fish." + echo "Please switch to bash first and re-run it, e.g.: bash $0" + read -r -p "Press Enter to continue anyway, or Ctrl+C to cancel..." /dev/null; then - echo "pacman detected. Installing prerequisites" - sudo pacman -Syu git zsh curl wget libnewt rsync --noconfirm --needed + # Install build prerequisites for shelly + if ! sudo pacman -S --needed --noconfirm base-devel git; then + echo "--------------------------------------------------------------------" + echo "Failed to install prerequisite packages for Shelly. You can try running it manually:" + echo "sudo pacman -S --needed --noconfirm base-devel git" + echo "--------------------------------------------------------------------" + exit 1 # exit with an error + fi + # Check if shelly binary exists + if ! command -v shelly >/dev/null; then + echo "shelly is NOT installed. Running installation commands..." + if ! git clone https://aur.archlinux.org/shelly.git /tmp/shelly_install; then + echo "--------------------------------------------------------------------" + echo "Failed to clone shelly repository. You can try running it manually:" + echo "git clone https://aur.archlinux.org/shelly.git /tmp/shelly_install" + echo "--------------------------------------------------------------------" + exit 1 # exit with an error + elif ! (cd /tmp/shelly_install && makepkg -si --noconfirm); then + echo "--------------------------------------------------------------------" + echo "Failed to build and install shelly. You can try running it manually:" + echo "cd /tmp/shelly_install && makepkg -si --noconfirm" + echo "--------------------------------------------------------------------" + exit 1 # exit with an error + fi + cd "$PreviousWD" + rm -rf /tmp/shelly_install + else + echo "Shelly is already installed." + fi +fi + +# Install prerequisites +if command -v shelly >/dev/null; then + echo "shelly detected. Installing prerequisites" + shelly install standard git zsh curl wget libnewt rsync whiptail --upgrade --no-confirm fi if command -v apt >/dev/null; then - echo "apt detected. Installing prerequisites" - sudo apt update - sudo apt full-upgrade -y - sudo apt install git zsh curl wget whiptail rsync -y + echo "apt detected. Installing prerequisites" + sudo apt update + sudo apt full-upgrade -y + sudo apt install git zsh curl wget whiptail rsync -y fi # Ensure whiptail is installed if ! command -v whiptail >/dev/null; then - echo "whiptail is not installed. Installing it now..." + echo "whiptail is not installed. Installing it now..." + + if command -v shelly >/dev/null; then + echo "shelly detected. Installing whiptail" + shelly install standard whiptail --no-confirm || { + echo "Failed to install whiptail. Exiting." + exit 1 + } + fi + + if command -v apt >/dev/null; then + echo "apt detected. Installing whiptail" + sudo apt install whiptail -y || { + echo "Failed to install whiptail. Exiting." + exit 1 + } + fi - if command -v pacman >/dev/null; then - echo "pacman detected. Installing prerequisites" - sudo pacman -S whiptail --noconfirm || { echo "Failed to install whiptail. Exiting."; exit 1; } - # Reload zsh if it exists - if command -v zsh -h >/dev/null; then - source ~/.zshrc - fi - # Reload Bash - source ~/.bashrc - fi - - if command -v apt >/dev/null; then - echo "apt detected. Installing prerequisites" - sudo apt install whiptail -y || { echo "Failed to install whiptail. Exiting."; exit 1; } - # Reload zsh if it exists - if command -v zsh -h >/dev/null; then - source ~/.zshrc - fi - # Reload Bash - source ~/.bashrc - fi - fi # Options for the whiptail menu OPTIONS=( - 1 "Run zsh setup script" OFF - 2 "Run fish setup script (NOT CREATED)" ON - 3 "Run LazyVim setup script" OFF - 4 "Install Docker" OFF - 5 "Install Pacman Packages" ON - 6 "Install Yay and AUR Packages" ON - 7 "Install affinity with GUI" OFF + 1 "Run zsh setup script" OFF + 2 "Run fish setup script" ON + 3 "Run LazyVim setup script" OFF + 4 "Install Docker" OFF + 5 "Install Standard Packages (Shelly)" ON + 6 "Install AUR Packages (Shelly)" ON + 7 "Install affinity with GUI" OFF ) CHOICE=$(whiptail --title "Installation Options" --checklist \ -"Choose components to install:" 20 78 10 \ - "${OPTIONS[@]}" 3>&1 1>&2 2>&3) + "Choose components to install:" 20 78 10 \ + "${OPTIONS[@]}" 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then - echo "User selected: $CHOICE" + echo "User selected: $CHOICE" else - echo "User cancelled installation." - exit 1 + echo "User cancelled installation." + exit 1 fi # Fail on any command. @@ -102,144 +136,127 @@ set -eu pipefail # Process selected options for selection in $CHOICE; do - clean_selection=$(echo $selection | tr -d '"') - case $clean_selection in - "1") - echo "Running zsh setup script..." - # Runs local script unless it does not exist or fails - if [[ -f "zsh.sh" ]]; then - echo "Found local script, running..." - bash zsh.sh --skip-watermark - else - bash "$(curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/zsh.sh)" --skip-watermark - fi - ;; - "2") - echo "Running fish setup script..." - # Runs local script unless it does not exist or fails - if [[ -f "fish.sh" ]]; then - echo "Found local script, running..." - bash fish.sh --skip-watermark - else - bash "$(curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/fish.sh)" --skip-watermark - fi - ;; - "3") - echo "Running LazyVim setup script..." - # Runs local script unless it does not exist or fails - if [[ -f "LazyVim.sh" ]];then - echo "Found local script, running..." - bash LazyVim.sh - else - curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/LazyVim.sh | bash - fi - ;; - "4") - echo "Installing Docker..." - if ! command -v docker >/dev/null; then - echo "docker is NOT installed. Installing..." - curl -fsSL https://get.docker.com | sh - sudo usermod -aG docker $USER - else - sudo usermod -aG docker $USER - echo "Docker is already installed." - echo "+ sleep 10" && sleep 10 - fi - ;; - "5") - echo "Installing Pacman Packages..." - # Check if pacman binary is installed - if command -v pacman /dev/null; then - echo "yay is NOT installed. Running installation commands..." - if ! git clone https://aur.archlinux.org/yay.git /tmp/yay_install; then - echo "--------------------------------------------------------------------" - echo "Failed to clone yay repository. You can try running it manually:" - echo "git clone https://aur.archlinux.org/yay.git /tmp/yay_install" - echo "--------------------------------------------------------------------" - exit 1 # exit with an error - elif ! (cd /tmp/yay_install && makepkg -si --noconfirm); then - echo "--------------------------------------------------------------------" - echo "Failed to build and install yay. You can try running it manually:" - echo "cd /tmp/yay_install && makepkg -si --noconfirm" - echo "--------------------------------------------------------------------" - exit 1 # exit with an error - fi - cd $PreviousWD - rm -rf /tmp/yay_install - else - echo "Yay is already installed." - fi - # Install yay packages - # Runs local script unless it does no exist or fails - if [[ -f "./config/PackagesYay.txt" ]]; then - echo "Found local config" - cat ./config/PackagesYay.txt | yay -S --needed --save --answerclean None --answerdiff None - --noconfirm - elif ! curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesYay.txt | yay -S --needed --save --answerclean None --answerdiff None - --noconfirm; then - echo "--------------------------------------------------------------------" - echo "Failed to install Yay packages. You can try running it manually:" - echo "curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesYay.txt | yay -S --needed --save --answerclean None --answerdiff None - --noconfirm" - echo "--------------------------------------------------------------------" - echo "+ sleep 10" && sleep 10 - fi - ;; - "7") - echo "Installing GUI dependencies" - if command -v pacman /dev/null; then + echo "docker is NOT installed. Installing..." + curl -fsSL https://get.docker.com | sh + sudo usermod -aG docker "$USER" + else + sudo usermod -aG docker "$USER" + echo "Docker is already installed." + echo "+ sleep 10" && sleep 10 + fi + ;; + "5") + echo "Installing Standard Packages via Shelly backup..." + # Check if shelly binary is installed + if ! command -v shelly >/dev/null; then + echo "Cannot proceed: shelly binary not found" + exit 1 # exit with an error + fi + # Install standard packages from shelly backup + # Runs local script unless it does not exist or fails + if [[ -f "./configs/shelly-standard.toml" ]]; then + echo "Found local backup" + shelly backup --import --name shelly-standard --directory ./configs --no-confirm + elif ! curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/shelly-standard.toml -o /tmp/shelly-standard.toml; then + echo "--------------------------------------------------------------------" + echo "Failed to download shelly backup. You can try running it manually:" + echo "curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/shelly-standard.toml -o /tmp/shelly-standard.toml" + echo "--------------------------------------------------------------------" + echo "+ sleep 10" && sleep 10 + elif ! shelly backup --import --name shelly-standard --directory /tmp --no-confirm; then + echo "--------------------------------------------------------------------" + echo "Failed to install Standard packages. You can try running it manually:" + echo "shelly backup --import --name shelly-standard --directory /tmp --no-confirm" + echo "--------------------------------------------------------------------" + echo "+ sleep 10" && sleep 10 + fi + ;; + "6") + echo "Installing AUR Packages via Shelly backup..." + # Check for shelly before installing AUR packages + if ! command -v shelly >/dev/null; then + echo "Cannot proceed: shelly binary not found" + exit 1 # Exit with an error + fi + # Install AUR packages from shelly backup + # Runs local script unless it does not exist or fails + if [[ -f "./configs/shelly-aur.toml" ]]; then + echo "Found local backup" + shelly backup --import --name shelly-aur --directory ./configs --no-confirm + elif ! curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/shelly-aur.toml -o /tmp/shelly-aur.toml; then + echo "--------------------------------------------------------------------" + echo "Failed to download shelly backup. You can try running it manually:" + echo "curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/shelly-aur.toml -o /tmp/shelly-aur.toml" + echo "--------------------------------------------------------------------" + echo "+ sleep 10" && sleep 10 + elif ! shelly backup --import --name shelly-aur --directory /tmp --no-confirm; then + echo "--------------------------------------------------------------------" + echo "Failed to install AUR packages. You can try running it manually:" + echo "shelly backup --import --name shelly-aur --directory /tmp --no-confirm" + echo "--------------------------------------------------------------------" + echo "+ sleep 10" && sleep 10 + fi + ;; + "7") + echo "Installing GUI dependencies" + if command -v shelly >/dev/null; then + echo "shelly found" + shelly install standard python-pyqt6 --no-confirm + fi + if command -v dnf >/dev/null; then + echo "dnf found" + sudo dnf install python3-pyqt6 + fi + if command -v apt >/dev/null; then + echo "apt found" + sudo apt install python3-pyqt6 -y + fi + echo "Install affinity with ryzendew's gui installer" + echo "You must manually select to install in the GUI" + echo "Github repo: https://github.com/ryzendew/Linux-Affinity-Installer" + echo "+ 10 sleep" + sleep 10 + curl -sSL https://raw.githubusercontent.com/ryzendew/AffinityOnLinux/refs/heads/main/AffinityScripts/AffinityLinuxInstaller.py | python3 + ;; + *) + echo "Invalid option selected: $selection" + ;; + esac done echo "Installation process complete." diff --git a/zsh.sh b/zsh.sh index 08aab5b..0dbe403 100755 --- a/zsh.sh +++ b/zsh.sh @@ -1,5 +1,13 @@ #!/usr/bin/bash +# Detect fish shell and ask user to switch to bash (bash-only syntax) +if [ -n "${FISH_VERSION:-}" ] || case "$SHELL" in *fish*) ;; *) false ;; esac; then + echo "Warning: fish shell detected." + echo "This script is written for bash and may have syntax issues under fish." + echo "Please switch to bash first and re-run it, e.g.: bash $0" + read -r -p "Press Enter to continue anyway, or Ctrl+C to cancel..."