mirror of
https://github.com/alvinlollo/Single-install-script.git
synced 2026-06-30 08:10:28 +10:00
Improve error handling
Refactor error handling and installation logic for Zsh.
This commit is contained in:
@@ -11,12 +11,20 @@ echo '
|
|||||||
--------------- ZSH Install Script ---------------
|
--------------- ZSH Install Script ---------------
|
||||||
'
|
'
|
||||||
|
|
||||||
# Do not exit on fail
|
# Enable exit on error
|
||||||
set +eux
|
set -eu
|
||||||
|
|
||||||
# Install prerequisites
|
# Install prerequisites
|
||||||
sudo pacman -S zsh git curl fzf --no-confirm
|
|
||||||
sudo apt install git curl zsh fzf -y # Just try if debian based
|
if command -v pacman >/dev/null; then
|
||||||
|
echo "pacman detected. Installing prerequisites"
|
||||||
|
sudo pacman -S zsh git curl fzf --no-confirm
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v apt >/dev/null; then
|
||||||
|
echo "apt detected. Installing prerequisites"
|
||||||
|
ssudo apt install git curl zsh fzf -y
|
||||||
|
fi
|
||||||
|
|
||||||
# Do not print commands
|
# Do not print commands
|
||||||
set +x
|
set +x
|
||||||
@@ -28,7 +36,16 @@ echo '
|
|||||||
# Print commands
|
# Print commands
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# Installs Oh-My-Zsh
|
# Disable exit on error
|
||||||
|
set +eu
|
||||||
|
|
||||||
|
# Move existing oh-my-zsh installation
|
||||||
|
mv ~/.oh-my-zsh ~/oh-my-zsh-backup
|
||||||
|
|
||||||
|
# Enable exit on error
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Install oh-my-zsh
|
||||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||||
|
|
||||||
# Install Oh-My-Zsh plugins
|
# Install Oh-My-Zsh plugins
|
||||||
|
|||||||
Reference in New Issue
Block a user