From bce96806324cdcbc7c5d2f2fb9d37862b7847d26 Mon Sep 17 00:00:00 2001 From: alvinlollo <143326475+alvinlollo@users.noreply.github.com> Date: Thu, 12 Feb 2026 22:40:31 +1100 Subject: [PATCH] Avoid package manager exit 1 The script will now skip the installation of the dependencies if they are already installed to avoid the script exiting early. --- zsh.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/zsh.sh b/zsh.sh index 9012731..8ac1e67 100755 --- a/zsh.sh +++ b/zsh.sh @@ -26,16 +26,18 @@ echo "This script will backup your current zsh config if it exists " # Enable exit on error set -eu -# Install prerequisites +# Install prerequisites if installed skips -if command -v pacman >/dev/null; then - echo "pacman detected. Installing prerequisites" - sudo pacman -S zsh git curl fzf --noconfirm -fi +if ! command -v zsh >/dev/null && command -v git >/dev/null && command -v curl >/dev/null && command -v fzf >/dev/null; then + if command -v pacman >/dev/null; then + echo "pacman detected. Installing prerequisites" + sudo pacman -S zsh git curl fzf --noconfirm + fi -if command -v apt >/dev/null; then - echo "apt detected. Installing prerequisites" - sudo apt install git curl zsh fzf -y + if command -v apt >/dev/null; then + echo "apt detected. Installing prerequisites" + sudo apt install git curl zsh fzf -y + fi fi zsh=$(which zsh)