From 152e1e07e0397ecc3f1778ea597d081c33ee8ff4 Mon Sep 17 00:00:00 2001
From: "n.st" <git@n-st.de>
Date: Wed, 18 Dec 2013 18:27:20 +0100
Subject: [PATCH] Cancel update if the current user doesn't have write
 permissions for the oh-my-zsh directory.

---
 tools/check_for_upgrade.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 0f8c9c39..d877e2a8 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -26,6 +26,13 @@ if [ -f ~/.zsh-update ]
 then
   . ~/.zsh-update
 
+  # cancel update if the current user doesn't have write permissions for the
+  # oh-my-zsh directory
+  if [ -n $(find -not -writable "$ZSH") ]
+  then
+    return 0;
+  fi
+
   if [[ -z "$LAST_EPOCH" ]]; then
     _update_zsh_update && return 0;
   fi