summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRobby Russell <robby@planetargon.com>2009-09-23 17:11:45 -0700
committerRobby Russell <robby@planetargon.com>2009-09-23 17:11:45 -0700
commit700a3f0badf89fc9bb5a8f54b5fd2e14aed2823d (patch)
treeabdf5a82b75da534c3dcb6641877d76d7e0d0d6a /tools
parentf363c025daa1dbf684f80ab7e29d34dbd5fb9d89 (diff)
downloadzsh-700a3f0badf89fc9bb5a8f54b5fd2e14aed2823d.tar.gz
zsh-700a3f0badf89fc9bb5a8f54b5fd2e14aed2823d.tar.bz2
zsh-700a3f0badf89fc9bb5a8f54b5fd2e14aed2823d.zip
Adding a script to check for upgrades
Diffstat (limited to 'tools')
-rw-r--r--tools/check_for_upgrade.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
new file mode 100644
index 000000000..feb999aff
--- /dev/null
+++ b/tools/check_for_upgrade.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+current_epoch=$(($(date +%s) / 60 / 60 / 24))
+
+if [ -f ~/.zsh-update ]
+then
+ source ~/.zsh-update
+ epoch_diff=$(($current_epoch - $LAST_EPOCH))
+ if [ $epoch_diff -gt 6 ]
+ then
+ echo "[Oh My Zsh] Would you like to check for updates?"
+ echo "Type Y to update oh-my-zsh: \c"
+ read line
+ if [ "$line" = Y ] || [ "$line" = y ]
+ then
+ /bin/sh $ZSH/tools/upgrade.sh
+ fi
+
+ # Set the last epoch to the current so that we don't ask for another week
+ echo "LAST_EPOCH=${current_epoch}" > ~/.zsh-update
+ fi
+else
+ # TODO: refactor this so remove duplicates
+ # Create the ~/.zsh-update file with the current epoch info
+ echo "LAST_EPOCH=${current_epoch}" > ~/.zsh-update
+fi
+
+