From ddac7a448fadf576b1efba3c1b3af23222e9b25f Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Tue, 12 Dec 2023 13:49:30 +0900 Subject: [PATCH] updated zsh install script --- install-scripts/zsh.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/install-scripts/zsh.sh b/install-scripts/zsh.sh index 42ffe2b..2352d17 100644 --- a/install-scripts/zsh.sh +++ b/install-scripts/zsh.sh @@ -56,8 +56,8 @@ install_package() { if [ -d "$HOME/.oh-my-zsh" ]; then printf "${NOTE} Oh My Zsh found. Creating a backup before uninstalling...${RESET}\n" # Perform backup using cp -r and create a backup directory with -backup suffix - mv "$HOME/.oh-my-zsh" "$HOME/.oh-my-zsh-backup" - mv "$HOME/.zshrc" "$HOME/.zshrc-backup" + cp -r "$HOME/.oh-my-zsh" "$HOME/.oh-my-zsh-backup" || true + mv "$HOME/.zshrc" "$HOME/.zshrc-backup" || true printf "${NOTE} Backup created....${RESET}\n" fi @@ -73,10 +73,14 @@ for ZSH in zsh zsh-completions pokemon-colorscripts-git; do done -## Install Oh My Zsh, plugins, and set zsh as default shell +# Install Oh My Zsh, plugins, and set zsh as default shell if command -v zsh >/dev/null; then - printf "${NOTE} Installing Oh My Zsh and plugins...\n" - sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || true + printf "${NOTE} Installing Oh My Zsh and plugins...\n" + if [ ! -d "$HOME/.oh-my-zsh" ]; then + sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || true + else + echo "Directory .oh-my-zsh already exists. Skipping re-installation." + fi # Check if the directories exist before cloning the repositories if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" ]; then git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions || true