Browse code

Merge pull request #707 from gmcmillan/master

Allow user to disable update prompt

Robby Russell authored on 15/12/2011 at 05:54:14
Showing 1 changed files
... ...
@@ -8,6 +8,12 @@ function _update_zsh_update() {
8 8
   echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
9 9
 }
10 10
 
11
+function _upgrade_zsh() {
12
+  /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
13
+  # update the zsh file
14
+  _update_zsh_update
15
+}
16
+
11 17
 if [ -f ~/.zsh-update ]
12 18
 then
13 19
   . ~/.zsh-update
... ...
@@ -19,17 +25,21 @@ then
19 19
   epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
20 20
   if [ $epoch_diff -gt 6 ]
21 21
   then
22
-    echo "[Oh My Zsh] Would you like to check for updates?"
23
-    echo "Type Y to update oh-my-zsh: \c"
24
-    read line
25
-    if [ "$line" = Y ] || [ "$line" = y ]
22
+    if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
26 23
     then
27
-      /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
28
-      # update the zsh file
29
-      _update_zsh_update
24
+      _upgrade_zsh
25
+    else
26
+      echo "[Oh My Zsh] Would you like to check for updates?"
27
+      echo "Type Y to update oh-my-zsh: \c"
28
+      read line
29
+      if [ "$line" = Y ] || [ "$line" = y ]
30
+      then
31
+        _upgrade_zsh
32
+      fi
30 33
     fi
31 34
   fi
32 35
 else
33 36
   # create the zsh file
34 37
   _update_zsh_update
35 38
 fi
39
+