mirror of
https://github.com/alvinlollo/Single-install-script.git
synced 2026-06-15 03:04:26 +10:00
Add comments, guardrails and --skip-watermark flag
This commit is contained in:
+37
-7
@@ -1,5 +1,11 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
skip_watermark=false
|
||||
if [ "$1" = "--skip-watermark" ]; then
|
||||
skip_watermark=true
|
||||
fi
|
||||
|
||||
if [ "$skip_watermark" = false ]; then
|
||||
clear
|
||||
echo '
|
||||
____ _ _ _ _ _
|
||||
@@ -13,6 +19,7 @@ echo '
|
||||
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE UNDER THE GPL-2.0 LICENCE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. See the LICENCE for more detail
|
||||
'
|
||||
fi
|
||||
|
||||
# Function to display error message
|
||||
function error_handler() {
|
||||
@@ -28,7 +35,7 @@ sudo pacman -Syu git zsh curl wget whiptail --noconfirm --needed
|
||||
|
||||
if command -v pacman >/dev/null; then
|
||||
echo "pacman detected. Installing prerequisites"
|
||||
sudo pacman -Syu git zsh curl wget whiptail golang fakeroot debugedit make gcc --noconfirm --needed
|
||||
sudo pacman -Syu git zsh curl wget whiptail --noconfirm --needed
|
||||
fi
|
||||
|
||||
if command -v apt >/dev/null; then
|
||||
@@ -43,11 +50,23 @@ if ! command -v whiptail >/dev/null; then
|
||||
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
|
||||
@@ -82,7 +101,7 @@ for selection in $CHOICE; do
|
||||
case $clean_selection in
|
||||
"1")
|
||||
echo "Running zsh setup script..."
|
||||
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/zsh.sh | bash
|
||||
bash "$(curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/zsh.sh)" --skip-watermark
|
||||
;;
|
||||
"2")
|
||||
echo "Running LazyVim setup script..."
|
||||
@@ -95,6 +114,7 @@ for selection in $CHOICE; do
|
||||
curl -fsSL https://get.docker.com | sh
|
||||
sudo usermod -aG docker $USER
|
||||
else
|
||||
sudo usermod -aG docker $USER
|
||||
echo "Docker is already installed."
|
||||
fi
|
||||
;;
|
||||
@@ -109,12 +129,20 @@ for selection in $CHOICE; do
|
||||
;;
|
||||
"5")
|
||||
echo "Installing Yay and Yay Packages..."
|
||||
if ! sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl; then
|
||||
# Check for pacman before installing yay
|
||||
if command -v pacman </dev/null; then
|
||||
echo "Cannot proceed: Not a arch based system"
|
||||
exit
|
||||
fi
|
||||
# Install yay prerequisites
|
||||
if ! sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl golang fakeroot debugedit make gcc; then
|
||||
echo "--------------------------------------------------------------------"
|
||||
echo "Failed to install prerequisite packages for Yay. You can try running it manually:"
|
||||
echo "sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl"
|
||||
echo "sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl golang fakeroot debugedit make gcc"
|
||||
echo "--------------------------------------------------------------------"
|
||||
exit
|
||||
fi
|
||||
# Check if yay binary exists
|
||||
if ! command -v yay >/dev/null; then
|
||||
echo "yay is NOT installed. Running installation commands..."
|
||||
if ! git clone https://aur.archlinux.org/yay.git /tmp/yay_install; then
|
||||
@@ -122,21 +150,23 @@ for selection in $CHOICE; do
|
||||
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
|
||||
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
|
||||
fi
|
||||
rm -rf /tmp/yay_install
|
||||
else
|
||||
echo "Yay is already installed."
|
||||
fi
|
||||
# Assuming PackagesYay.txt for yay packages, as per common practice
|
||||
if ! 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; then
|
||||
# Install yay packages
|
||||
if ! 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 All --answerdiff All - --noconfirm"
|
||||
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 "--------------------------------------------------------------------"
|
||||
fi
|
||||
;;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
skip_watermark=false
|
||||
if [ "$1" = "--skip-watermark" ]; then
|
||||
skip_watermark=true
|
||||
fi
|
||||
|
||||
if [ "$skip_watermark" = false ]; then
|
||||
echo '
|
||||
____ _ _ _ _ _
|
||||
| __ ) _ _ __ _| |_ _(_)_ __ | | ___ | | | ___
|
||||
@@ -9,7 +15,13 @@ echo '
|
||||
|___/
|
||||
|
||||
--------------- ZSH Install Script ---------------
|
||||
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE UNDER THE GPL-2.0 LICENCE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. See the LICENCE for more detail
|
||||
'
|
||||
fi
|
||||
|
||||
# Show disclaimer
|
||||
echo "This script will backup your current zsh config if it exists "
|
||||
|
||||
# Enable exit on error
|
||||
set -eu
|
||||
@@ -39,10 +51,13 @@ set -x
|
||||
# Disable exit on error
|
||||
set +eu
|
||||
|
||||
rm -rf ~/.oh-my-zsh
|
||||
|
||||
# Enable exit on error
|
||||
set -eu
|
||||
|
||||
rm -rf ~/.oh-my-zsh
|
||||
# Do not print commands
|
||||
set +x
|
||||
|
||||
# Install oh-my-zsh without entering zsh
|
||||
CHSH=no sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||
@@ -54,12 +69,15 @@ git clone https://github.com/z-shell/zsh-eza ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/
|
||||
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
|
||||
|
||||
# Enable exit on error
|
||||
set -eu
|
||||
# Disable exit on error
|
||||
set +eu
|
||||
|
||||
# Backup old config file if it exists
|
||||
cp .zshrc .zshrc.backup
|
||||
|
||||
# Enable exit on error
|
||||
set -eu
|
||||
|
||||
# Download and replace config file
|
||||
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/.zshrc -o ~/.zshrc
|
||||
|
||||
@@ -71,3 +89,13 @@ mkdir -p ~/.fzf/shell
|
||||
touch ~/.fzf/shell/key-bindings.zsh
|
||||
|
||||
sudo sh -c "echo $(which zsh) >> /etc/shells"
|
||||
|
||||
# Do not print commands
|
||||
set +x
|
||||
|
||||
echo 'Please run to change default shell:
|
||||
chsh -s /bin/zsh'
|
||||
|
||||
# Print commands
|
||||
set -x
|
||||
sleep 10
|
||||
|
||||
Reference in New Issue
Block a user