700a3f0badf89fc9bb5a8f54b5fd2e14aed2823d

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Adding a script to check for upgrades

Diff

 1diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..feb999aff75a1d6e8418667868164dfd36868f81
 4--- /dev/null
 5+++ b/tools/check_for_upgrade.sh
 6@@ -0,0 +1,28 @@
 7+#!/bin/sh
 8+
 9+current_epoch=$(($(date +%s) / 60 / 60 / 24))
10+
11+if [ -f ~/.zsh-update ]
12+then
13+  source ~/.zsh-update
14+  epoch_diff=$(($current_epoch - $LAST_EPOCH))
15+  if [ $epoch_diff -gt 6 ]
16+  then
17+    echo "[Oh My Zsh] Would you like to check for updates?"
18+    echo "Type Y to update oh-my-zsh: \c"
19+    read line
20+    if [ "$line" = Y ] || [ "$line" = y ]
21+    then
22+      /bin/sh $ZSH/tools/upgrade.sh
23+    fi
24+
25+    # Set the last epoch to the current so that we don't ask for another week
26+    echo "LAST_EPOCH=${current_epoch}" > ~/.zsh-update
27+  fi
28+else
29+  # TODO: refactor this so remove duplicates
30+  # Create the ~/.zsh-update file with the current epoch info
31+  echo "LAST_EPOCH=${current_epoch}" > ~/.zsh-update
32+fi
33+
34+