diff options
Diffstat (limited to 'tools/install.sh')
-rwxr-xr-x | tools/install.sh | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/install.sh b/tools/install.sh index 187c828f5..0cc020053 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -24,12 +24,10 @@ main() { # which may fail on systems lacking tput or terminfo set -e - CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) - if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then + if ! command -v zsh >/dev/null 2>&1; then printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" exit fi - unset CHECK_ZSH_INSTALLED if [ ! -n "$ZSH" ]; then ZSH=~/.oh-my-zsh @@ -49,7 +47,7 @@ main() { umask g-w,o-w printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" - hash git >/dev/null 2>&1 || { + command -v git >/dev/null 2>&1 || { echo "Error: git is not installed" exit 1 } @@ -61,7 +59,7 @@ main() { exit 1 fi fi - env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { + env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$ZSH" || { printf "Error: git clone of oh-my-zsh repo failed\n" exit 1 } @@ -74,9 +72,9 @@ main() { fi printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" - cp $ZSH/templates/zshrc.zsh-template ~/.zshrc + cp "$ZSH"/templates/zshrc.zsh-template ~/.zshrc sed "/^export ZSH=/ c\\ - export ZSH=$ZSH + export ZSH=\"$ZSH\" " ~/.zshrc > ~/.zshrc-omztemp mv -f ~/.zshrc-omztemp ~/.zshrc @@ -110,7 +108,7 @@ main() { echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.' echo '' printf "${NORMAL}" - env zsh + env zsh -l } main |