diff options
author | Tharre <tharre3@gmail.com> | 2018-05-09 02:58:18 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2018-05-09 17:28:13 +0200 |
commit | 321d9a8247d50cd634615ffed707aed3f4376108 (patch) | |
tree | 32fbd27e3a9e8c3f41d68232ffe203ef0ce10999 /bin/update_dotfiles | |
parent | 3cb67ddae1d11e4cda22b9843665b6d3775828da (diff) | |
download | dotfiles-321d9a8247d50cd634615ffed707aed3f4376108.tar.gz dotfiles-321d9a8247d50cd634615ffed707aed3f4376108.tar.xz dotfiles-321d9a8247d50cd634615ffed707aed3f4376108.zip |
Move various scripts and functions into bin/
Diffstat (limited to 'bin/update_dotfiles')
-rwxr-xr-x | bin/update_dotfiles | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/update_dotfiles b/bin/update_dotfiles new file mode 100755 index 0000000..6c45971 --- /dev/null +++ b/bin/update_dotfiles @@ -0,0 +1,20 @@ +#!/bin/sh -e + +dotfiles="$HOME/dotfiles" +epoch_file="$dotfiles/.updated" +epoch_curr=$(date +'%s') +[ -e "$epoch_file" ] && epoch_old=$(<"$epoch_file") +epoch_diff=$(($epoch_curr - ${epoch_old:-0})) +max_time=$((60 * 60 * 24 * 7)) + +if [ $(($epoch_diff / $max_time)) -ne 0 ]; then + echo "Updating dotfiles ..." + + cd "$dotfiles" + git pull --rebase --stat origin master + echo $epoch_curr > "$epoch_file" + ./install.sh + cd - + + echo "Finished." +fi |