浏览代码

Cancel upgrade if $ZSH is not writable
from #2360

n.st 11 年之前
父节点
当前提交
a9e1d9aa89
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      tools/check_for_upgrade.sh

+ 6 - 0
tools/check_for_upgrade.sh

@@ -20,6 +20,12 @@ if [[ -z "$epoch_target" ]]; then
   epoch_target=13
   epoch_target=13
 fi
 fi
 
 
+[ -f ~/.profile ] && source ~/.profile
+
+# Cancel upgrade if the current user doesn't have write permissions for the
+# oh-my-zsh directory.
+[[ -w "$ZSH" ]] || return 0
+
 if [ -f ~/.zsh-update ]
 if [ -f ~/.zsh-update ]
 then
 then
   . ~/.zsh-update
   . ~/.zsh-update