Run local scripts first before using from github

This commit is contained in:
alvinlollo
2026-01-21 16:19:05 -08:00
parent fd6f3f5b37
commit 3a139a3563
3 changed files with 71 additions and 20 deletions
+2 -1
View File
@@ -2,7 +2,8 @@
if command -v pacman </dev/null; then if command -v pacman </dev/null; then
echo "Cannot proceed: Not a arch based system" echo "Cannot proceed: Not a arch based system"
echo "This script does not have debian support" echo "This script does not have debian support"
exit echo "+ sleep 10" && sleep 10
exit 1
fi fi
sudo pacman -S --needed --noconfirm git curl wget python3 python-pip sudo pacman -S --needed --noconfirm git curl wget python3 python-pip
+39 -13
View File
@@ -16,8 +16,9 @@ echo '
|___/ |___/
--------------- Single Download script (Beta) --------------- --------------- Single Download script (Beta) ---------------
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE UNDER THE GPL-2.0 LICENCE, THERE IS NO WARRANTY BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE UNDER THE GPL-2.0 LICENCE,
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. See the LICENCE for more detail THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
See the LICENCE for more detail
' '
fi fi
@@ -40,6 +41,8 @@ fi
if command -v apt >/dev/null; then if command -v apt >/dev/null; then
echo "apt detected. Installing prerequisites" 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 -y
fi fi
@@ -101,36 +104,54 @@ for selection in $CHOICE; do
case $clean_selection in case $clean_selection in
"1") "1")
echo "Running zsh setup script..." echo "Running zsh setup script..."
bash "$(curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/zsh.sh)" --skip-watermark # 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; then
else
bash "$(curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/zsh.sh)" --skip-watermark
fi
;; ;;
"2") "2")
echo "Running LazyVim setup script..." echo "Running LazyVim setup script..."
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/LazyVim.sh | bash # Runs local script unless it does not exist or fails
if [[ -f "LazyVim.sh" ]];then
echo "Found local script, running..."
bash LazyVim.sh; then
else
curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/LazyVim.sh | bash
fi
;; ;;
"3") "3")
echo "Installing Docker..." echo "Installing Docker..."
if ! command -v docker >/dev/null; then if ! command -v docker >/dev/null; then
echo "docker is NOT installed. Running installation commands..." echo "docker is NOT installed. Installing..."
curl -fsSL https://get.docker.com | sh curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER sudo usermod -aG docker $USER
else else
sudo usermod -aG docker $USER sudo usermod -aG docker $USER
echo "Docker is already installed." echo "Docker is already installed."
echo "+ sleep 10" && sleep 10
fi fi
;; ;;
"4") "4")
echo "Installing Pacman Packages..." echo "Installing Pacman Packages..."
# Check if pacman binary is installed # Check if pacman binary is installed
if command -v pacman </dev/null; then if command -v pacman </dev/null; then
echo "Cannot proceed: Not a arch based system" echo "Cannot proceed: pacman binary not found"
exit exit 1 # exit with an error
fi fi
# Install pacman packages # Install pacman packages
if ! curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesPacman.txt | sudo pacman -S - --needed --noconfirm; then # 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
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
echo "Failed to install Pacman packages. You can try running it manually:" 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 "curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/configs/PackagesPacman.txt | sudo pacman -S - --needed --noconfirm"
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
echo "+ sleep 10" && sleep 10
fi fi
;; ;;
"5") "5")
@@ -138,7 +159,7 @@ for selection in $CHOICE; do
# Check for pacman before installing yay # Check for pacman before installing yay
if command -v pacman </dev/null; then if command -v pacman </dev/null; then
echo "Cannot proceed: Not a arch based system" echo "Cannot proceed: Not a arch based system"
exit exit 1 # Exit with an error
fi fi
# Install yay prerequisites # Install yay prerequisites
if ! sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl golang fakeroot debugedit make gcc; then if ! sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl golang fakeroot debugedit make gcc; then
@@ -146,7 +167,7 @@ for selection in $CHOICE; do
echo "Failed to install prerequisite packages for Yay. You can try running it manually:" echo "Failed to install prerequisite packages for Yay. You can try running it manually:"
echo "sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl golang fakeroot debugedit make gcc" echo "sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl golang fakeroot debugedit make gcc"
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
exit exit 1 # exit with an error
fi fi
# Check if yay binary exists # Check if yay binary exists
if ! command -v yay >/dev/null; then if ! command -v yay >/dev/null; then
@@ -156,24 +177,29 @@ for selection in $CHOICE; do
echo "Failed to clone yay repository. You can try running it manually:" 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 "git clone https://aur.archlinux.org/yay.git /tmp/yay_install"
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
exit exit 1 # exit with an error
elif ! (cd /tmp/yay_install && makepkg -si --noconfirm); then elif ! (cd /tmp/yay_install && makepkg -si --noconfirm); then
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
echo "Failed to build and install yay. You can try running it manually:" echo "Failed to build and install yay. You can try running it manually:"
echo "cd /tmp/yay_install && makepkg -si --noconfirm" echo "cd /tmp/yay_install && makepkg -si --noconfirm"
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
exit exit 1 # exit with an error
fi fi
rm -rf /tmp/yay_install rm -rf /tmp/yay_install
else else
echo "Yay is already installed." echo "Yay is already installed."
fi fi
# Install yay packages # 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 # 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; then
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 "--------------------------------------------------------------------"
echo "Failed to install Yay packages. You can try running it manually:" 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 "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 "--------------------------------------------------------------------"
echo "+ sleep 10" && sleep 10
fi fi
;; ;;
*) *)
+30 -6
View File
@@ -62,6 +62,9 @@ set +x
# Install oh-my-zsh without entering zsh # Install oh-my-zsh without entering zsh
CHSH=no sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended CHSH=no sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
# Print commands
set -x
# Install Oh-My-Zsh plugins # Install Oh-My-Zsh 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-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/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
@@ -73,7 +76,7 @@ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:
set +eu set +eu
# Backup old config file if it exists # Backup old config file if it exists
cp .zshrc .zshrc.backup cp .zshrc .zshrc{,.bak} -r
# Enable exit on error # Enable exit on error
set -eu set -eu
@@ -88,14 +91,35 @@ curl -fsSL https://raw.githubusercontent.com/alvinlollo/Single-install-script/re
mkdir -p ~/.fzf/shell mkdir -p ~/.fzf/shell
touch ~/.fzf/shell/key-bindings.zsh touch ~/.fzf/shell/key-bindings.zsh
sudo sh -c "echo $(which zsh) >> /etc/shells"
# Do not print commands # Do not print commands
set +x set +x
echo 'Please run to change default shell: # If this user's login shell is already "zsh", do not attempt to switch.
chsh -s /bin/zsh' if [ "$(basename -- "$SHELL")" = "zsh" ]; then
return
fi
if command -v chsh >/dev/null; then
echo "chsh command does not exist."
echo "Please change your shell manually"
sleep 5 && exit 0
fi
echo "Changing your shell to $zsh..."
if ! sudo -k chsh -s "$zsh" "$USER"; then # -k forces password prompt
echo "Next command may fail."
chsh -s $"(which zsh)" "$USER" # run chsh normally may fail
fi
# Check if the shell change was successful
if [ $? -ne 0 ]; then
echo "chsh command unsuccessful. Change your default shell manually:"
echo "chsh -s $"(which zsh)" $USER"
else
export SHELL="$zsh"
echo "Shell successfully changed to '$zsh'."
fi
# Print commands # Print commands
set -x set -x
sleep 10