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