Update installbeta.sh

This commit is contained in:
alvinlollo
2025-04-14 16:42:27 +10:00
committed by GitHub
parent 648126f631
commit be6aa3451c
+28 -22
View File
@@ -43,15 +43,15 @@ whiptail_options=(
)
# Append options to the whiptail command
for option in "${whiptail_options[@]}"; do
whiptail_command+=("$option")
for i in "${!whiptail_options[@]}"; do
whiptail_command+=("${whiptail_options[$i]}")
done
# Function to get user selections
get_user_selection() {
local selections
# Execute whiptail and capture the output
selections=$( "${whiptail_command[@]}" )
selections=$(whiptail "${whiptail_command[@]}" 2>/dev/null)
if [ $? -ne 0 ]; then
echo "INFO No options selected. Exiting."
@@ -69,34 +69,34 @@ execute_commands() {
case "$option" in
"homebrew")
echo "INFO Executing commands for Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew upgrade
brew install fzf gcc eza thefuck gh
/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")
echo "INFO Executing commands for Oh-My-Zsh"
sudo apt install zsh fzf -y
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sudo apt install zsh fzf -y || echo "ERROR Failed to install zsh and fzf"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" || echo "ERROR Failed to install Oh-My-Zsh"
# Installs plugins
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/z-shell/zsh-eza ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-eza
git clone --depth 1 https://github.com/unixorn/fzf-zsh-plugin.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-zsh-plugin
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
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"
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"
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"
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"
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"
echo "INFO Configuring Oh-MyZsh"
# Backup old config file if it exists
if [ -f ~/.zshrc ]; then
cp ~/.zshrc ~/.zshrc.backup
cp ~/.zshrc ~/.zshrc.backup || echo "ERROR Failed to backup .zshrc"
fi
# Download and replace config file
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/.zshrc -o ~/.zshrc
mkdir -p ~/.fzf/shell
touch ~/.fzf/shell/key-bindings.zsh
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
@@ -104,19 +104,19 @@ execute_commands() {
;;
"gef")
echo "INFO Executing commands for GEF"
bash -c "$(curl -fsSL https://gef.blah.cat/sh)"
bash -c "$(curl -fsSL https://gef.blah.cat/sh)" || echo "ERROR Failed to install GEF"
;;
"apt_packages")
echo "INFO Executing commands for apt 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
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"
;;
"casaos")
echo "INFO Executing commands for Casa Os"
curl -fsSL https://get.casaos.io | sudo bash
curl -fsSL https://get.casaos.io | sudo bash || echo "ERROR Failed to install CasaOS"
;;
"docker")
echo "INFO Executing commands for Docker"
curl -fsSL https://get.docker.com | sh
curl -fsSL https://get.docker.com | sh || echo "ERROR Failed to install Docker"
;;
*)
echo "WARN Unknown option: $option"
@@ -131,6 +131,12 @@ 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"