fix(installer): fix removal of OMZ directory on failure

When the `git init` call fails, the directory is not created,
so the rm command fails with a not found error. This change
checks whether the directory exists before deleting it.
This commit is contained in:
Marc Cornellà 2022-02-25 14:06:19 +01:00
parent 99460351eb
commit c81804825c
No known key found for this signature in database
GPG Key ID: 0314585E776A9C1B
1 changed files with 1 additions and 1 deletions

View File

@ -283,7 +283,7 @@ setup_ohmyzsh() {
&& git remote add origin "$REMOTE" \ && git remote add origin "$REMOTE" \
&& git fetch --depth=1 origin \ && git fetch --depth=1 origin \
&& git checkout -b "$BRANCH" "origin/$BRANCH" || { && git checkout -b "$BRANCH" "origin/$BRANCH" || {
rm -rf "$ZSH" [ ! -d "$ZSH" ] || rm -rf "$ZSH" 2>/dev/null
fmt_error "git clone of oh-my-zsh repo failed" fmt_error "git clone of oh-my-zsh repo failed"
exit 1 exit 1
} }