mirror of
https://github.com/alvinlollo/Single-install-script.git
synced 2026-07-10 02:40:32 +10:00
Create installbeta.sh
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
# Project Overview
|
||||||
|
|
||||||
|
This project consists of a collection of shell scripts designed to automate the installation and configuration of a development environment on Arch Linux-based systems. It uses `pacman` for system packages and `yay` for AUR packages.
|
||||||
|
|
||||||
|
The main components are:
|
||||||
|
- **`install.sh`**: The primary script that runs through the entire installation process.
|
||||||
|
- **`installbeta.sh`**: A newer, interactive version of the installation script that uses `whiptail` to provide a menu-driven interface.
|
||||||
|
- **`zsh.sh`**: A script dedicated to setting up Zsh, Oh My Zsh, and several useful plugins.
|
||||||
|
- **`LazyVim.sh`**: A script for setting up a LazyVim configuration for Neovim.
|
||||||
|
- **`configs/`**: A directory containing configuration files, including `.zshrc` and lists of packages to be installed (`PackagesPacman.txt`, `PackagesYay.txt`).
|
||||||
|
|
||||||
|
# Building and Running
|
||||||
|
|
||||||
|
These are shell scripts and do not require a build process. They can be executed directly.
|
||||||
|
|
||||||
|
**Running the main installation:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**Running the interactive installation:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./installbeta.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**Running individual setup scripts:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./zsh.sh
|
||||||
|
./LazyVim.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
# Development Conventions
|
||||||
|
|
||||||
|
- The scripts are written in `bash`.
|
||||||
|
- They are designed to be run on Arch Linux and may have some compatibility with other systems (e.g., `zsh.sh` has checks for `apt`).
|
||||||
|
- The scripts use `set -eux pipefail` to ensure that they exit on any error and print commands as they are executed, which is good for debugging. This is toggled off for specific commands that might fail without being critical.
|
||||||
|
- The scripts frequently use `curl` to download other scripts or configuration files from the associated GitHub repository.
|
||||||
|
- Package lists are maintained in `configs/PackagesPacman.txt` and `configs/PackagesYay.txt`.
|
||||||
|
- Python dependencies for some tools are listed in `requirements.txt` and installed via `pip`.
|
||||||
@@ -42,6 +42,7 @@ flatpak
|
|||||||
fortune-mod
|
fortune-mod
|
||||||
fuse-overlayfs
|
fuse-overlayfs
|
||||||
fzf
|
fzf
|
||||||
|
gemini-cli
|
||||||
git
|
git
|
||||||
glib2-devel
|
glib2-devel
|
||||||
gnome-2048
|
gnome-2048
|
||||||
|
|||||||
+75
-116
@@ -1,147 +1,106 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo -e "\e[0m\c"
|
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
echo '
|
echo '
|
||||||
____ _ _ _ _ _
|
____ _ _ _ _ _
|
||||||
| _ \ _ _ __ _| |_ _(_)_ __ | | ___ | | | ___
|
| __ ) _ _ __ _| |_ _(_)_ __ | | ___ | | | ___
|
||||||
| _ \| | | | / _ | \ \ / / | _ \| |/ _ \| | |/ _ \
|
| _ \| | | | / _ | \ \ / / | _ \| |/ _ \| | |/ _ \
|
||||||
| |_) | |_| | | (_| | |\ V /| | | | | | (_) | | | (_) |
|
| |_) | |_| | | (_| | |\ V /| | | | | | (_) | | | (_) |
|
||||||
|____/ \__ | \__ _|_| \_/ |_|_| |_|_|\___/|_|_|\___/
|
|____/ \__ | \__ _|_| \_/ |_|_| |_|_|\___/|_|_|\___/
|
||||||
|___/
|
|___/
|
||||||
|
|
||||||
--------------- Single Download script ---------------
|
--------------- Single Download script (BETA) ---------------
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# Function to display error message
|
||||||
|
function error_handler() {
|
||||||
|
echo " "
|
||||||
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
|
echo "An error occurred. Please check the output above for details."
|
||||||
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
|
||||||
|
# Trap errors
|
||||||
|
trap error_handler ERR
|
||||||
|
|
||||||
#Install prerequisites
|
#Install prerequisites
|
||||||
echo "Install prerequisites"
|
sudo pacman -Syu git zsh curl --noconfirm --needed
|
||||||
echo
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y git zsh curl git build-essential whiptail
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Update system
|
# Ensure whiptail is installed
|
||||||
echo "Update system"
|
if ! command -v whiptail >/dev/null; then
|
||||||
echo
|
echo "whiptail is not installed. Installing it now..."
|
||||||
sudo apt full-upgrade -y
|
sudo pacman -S --noconfirm whiptail || { echo "Failed to install whiptail. Exiting."; exit 1; }
|
||||||
echo
|
fi
|
||||||
|
|
||||||
# Build whiptail command
|
# Options for the whiptail menu
|
||||||
whiptail_command=(
|
OPTIONS=(
|
||||||
whiptail --title "Select Options" --checklist "Choose options to install" 28 85 20
|
1 "Run zsh setup script" OFF
|
||||||
|
2 "Run LazyVim setup script" OFF
|
||||||
|
3 "Install Docker" OFF
|
||||||
|
4 "Install Pacman Packages" OFF
|
||||||
|
5 "Install Yay and AUR Packages" OFF
|
||||||
)
|
)
|
||||||
|
|
||||||
whiptail_options=(
|
CHOICE=$(whiptail --title "Installation Options" --checklist \
|
||||||
"homebrew" "Installs homebrew using the install script" "OFF"
|
"Choose components to install:" 20 78 10 \
|
||||||
"ohmyzsh" "Installs Oh-My-Zsh with plugins and configurations" "ON"
|
"${OPTIONS[@]}" 3>&1 1>&2 2>&3)
|
||||||
"gef" "Installs GEF (https://github.com/hugsy/gef/)" "OFF"
|
|
||||||
"apt_packages" "Installs packages and utilities" "ON"
|
|
||||||
"casaos" "Installs CasaOs using the install script" "OFF"
|
|
||||||
"docker" "Installs Docker with install script" "OFF"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Append options to the whiptail command
|
exitstatus=$?
|
||||||
for i in "${!whiptail_options[@]}"; do
|
if [ $exitstatus = 0 ]; then
|
||||||
whiptail_command+=("${whiptail_options[$i]}")
|
echo "User selected: $CHOICE"
|
||||||
done
|
else
|
||||||
|
echo "User cancelled installation."
|
||||||
# Function to get user selections
|
|
||||||
get_user_selection() {
|
|
||||||
local selections
|
|
||||||
# Execute whiptail and capture the output
|
|
||||||
selections=$(whiptail "${whiptail_command[@]}" 2>/dev/null)
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "INFO No options selected. Exiting."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$selections"
|
# Fail on any command.
|
||||||
}
|
set -eux pipefail
|
||||||
|
|
||||||
# Function to execute commands based on user selection
|
# Process selected options
|
||||||
execute_commands() {
|
for selection in $CHOICE; do
|
||||||
local options=("$@") # Get options as an array
|
clean_selection=$(echo $selection | tr -d '"')
|
||||||
|
case $clean_selection in
|
||||||
for option in "${options[@]}"; do
|
"1")
|
||||||
case "$option" in
|
echo "Running zsh setup script..."
|
||||||
"homebrew")
|
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/zsh.sh | bash
|
||||||
echo "INFO Executing commands for Homebrew"
|
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || echo "ERROR Failed to install Homebrew"
|
|
||||||
brew update || echo "ERROR Homebrew update failed"
|
|
||||||
brew upgrade || echo "ERROR Homebrew upgrade failed"
|
|
||||||
brew install fzf gcc eza thefuck gh || echo "ERROR Failed to install Homebrew packages"
|
|
||||||
;;
|
;;
|
||||||
"ohmyzsh")
|
"2")
|
||||||
echo "INFO Executing commands for Oh-My-Zsh"
|
echo "Running LazyVim setup script..."
|
||||||
sudo apt install zsh fzf -y || echo "ERROR Failed to install zsh and fzf"
|
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/LazyVim.sh | bash
|
||||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" || echo "ERROR Failed to install Oh-My-Zsh"
|
;;
|
||||||
|
"3")
|
||||||
# Installs plugins
|
echo "Installing Docker..."
|
||||||
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search || echo "ERROR Failed to install zsh-history-substring-search"
|
if ! command -v docker >/dev/null; then
|
||||||
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions || echo "ERROR Failed to install zsh-autosuggestions"
|
echo "docker is NOT installed. Running installation commands..."
|
||||||
git clone https://github.com/z-shell/zsh-eza ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-eza || echo "ERROR Failed to install zsh-eza"
|
curl -fsSL https://get.docker.com | sh
|
||||||
git clone --depth 1 https://github.com/unixorn/fzf-zsh-plugin.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-zsh-plugin || echo "ERROR Failed to install fzf-zsh-plugin"
|
sudo usermod -aG docker $USER
|
||||||
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting || echo "ERROR Failed to install zsh-syntax-highlighting"
|
else
|
||||||
|
echo "Docker is already installed."
|
||||||
echo "INFO Configuring Oh-MyZsh"
|
|
||||||
|
|
||||||
# Backup old config file if it exists
|
|
||||||
if [ -f ~/.zshrc ]; then
|
|
||||||
cp ~/.zshrc ~/.zshrc.backup || echo "ERROR Failed to backup .zshrc"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download and replace config file
|
|
||||||
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/.zshrc -o ~/.zshrc || echo "ERROR Failed to download .zshrc"
|
|
||||||
mkdir -p ~/.fzf/shell || echo "ERROR Failed to create .fzf/shell"
|
|
||||||
touch ~/.fzf/shell/key-bindings.zsh || echo "ERROR Failed to create key-bindings.zsh"
|
|
||||||
|
|
||||||
source ~/.zshrc
|
|
||||||
source ~/.zshrc
|
|
||||||
source ~/.zshrc
|
|
||||||
;;
|
;;
|
||||||
"gef")
|
"4")
|
||||||
echo "INFO Executing commands for GEF"
|
echo "Installing Pacman Packages..."
|
||||||
bash -c "$(curl -fsSL https://gef.blah.cat/sh)" || echo "ERROR Failed to install GEF"
|
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesPacman.txt | sudo pacman -S - --needed --noconfirm
|
||||||
;;
|
;;
|
||||||
"apt_packages")
|
"5")
|
||||||
echo "INFO Executing commands for apt Packages"
|
echo "Installing Yay and Yay Packages..."
|
||||||
sudo apt install -y python3 python3-pip git htop golang figlet irssi cmatrix neofetch cowsay fortune-mod tint smartmontools udevil samba cifs-utils mergerfs tty-clock lolcat libsass1 dpkg npm python3 needrestart lynx wget curl zsh net-tools network-manager tmux --fix-missing || echo "ERROR Failed to install apt packages"
|
sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl # These were in the original script before yay install
|
||||||
;;
|
if ! command -v yay >/dev/null; then
|
||||||
"casaos")
|
echo "yay is NOT installed. Running installation commands..."
|
||||||
echo "INFO Executing commands for Casa Os"
|
git clone https://aur.archlinux.org/yay.git /tmp/yay_install
|
||||||
curl -fsSL https://get.casaos.io | sudo bash || echo "ERROR Failed to install CasaOS"
|
(cd /tmp/yay_install && makepkg -si --noconfirm)
|
||||||
;;
|
rm -rf /tmp/yay_install
|
||||||
"docker")
|
else
|
||||||
echo "INFO Executing commands for Docker"
|
echo "Yay is already installed."
|
||||||
curl -fsSL https://get.docker.com | sh || echo "ERROR Failed to install Docker"
|
fi
|
||||||
|
# Assuming PackagesYay.txt for yay packages, as per common practice
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesYay.txt | yay -S --needed --save --answerclean All --answerdiff All - --noconfirm
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "WARN Unknown option: $option"
|
echo "Invalid option selected: $selection"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
|
||||||
|
|
||||||
# Main script logic
|
echo "Installation process complete."
|
||||||
echo "INFO Starting the installation process..."
|
|
||||||
|
|
||||||
# Get user selections
|
|
||||||
selected_options=$(get_user_selection)
|
|
||||||
|
|
||||||
# Check if selected_options is empty
|
|
||||||
if [ -z "$selected_options" ]; then
|
|
||||||
echo "INFO No options selected. Exiting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Convert selected options into an array (splitting by space)
|
|
||||||
IFS=' ' read -r -a options <<< "$selected_options"
|
|
||||||
|
|
||||||
# Execute commands based on selections
|
|
||||||
execute_commands "${options[@]}"
|
|
||||||
|
|
||||||
echo "INFO Installation process completed."
|
|
||||||
exit 0
|
|
||||||
Reference in New Issue
Block a user