a9e1d9aa890c18ea3c3250442e7d9de555633237

Author
n.st <git@n-st.de>
Committer
ncanceill <nicolas.canceill@ens-cachan.org>
Date

Message

Cancel upgrade if $ZSH is not writable
from #2360

Diff

 1diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
 2index c5fd0cce15e6e1b841454450fc662dc6af90e971..8b8ecae035fa0f47193b57e64fff82eff01af1ea 100644
 3--- a/tools/check_for_upgrade.sh
 4+++ b/tools/check_for_upgrade.sh
 5@@ -20,6 +20,12 @@ if [[ -z "$epoch_target" ]]; then
 6   epoch_target=13
 7 fi
 8 
 9+[ -f ~/.profile ] && source ~/.profile
10+
11+# Cancel upgrade if the current user doesn't have write permissions for the
12+# oh-my-zsh directory.
13+[[ -w "$ZSH" ]] || return 0
14+
15 if [ -f ~/.zsh-update ]
16 then
17   . ~/.zsh-update