summaryrefslogtreecommitdiff
path: root/tools/check_for_upgrade.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/check_for_upgrade.sh')
-rw-r--r--tools/check_for_upgrade.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 581f03a07..35e074297 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -5,11 +5,11 @@ function _current_epoch() {
}
function _update_zsh_update() {
- echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
+ echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update
}
function _upgrade_zsh() {
- /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
+ env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
# update the zsh file
_update_zsh_update
}
@@ -20,6 +20,12 @@ if [[ -z "$epoch_target" ]]; then
epoch_target=13
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 ]
then
. ~/.zsh-update