diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/check_upstream.sh | 19 | ||||
-rw-r--r-- | scripts/sync-vimwiki.cron | 1 | ||||
-rwxr-xr-x | scripts/sync.sh | 9 |
3 files changed, 29 insertions, 0 deletions
diff --git a/scripts/check_upstream.sh b/scripts/check_upstream.sh new file mode 100644 index 0000000..888061e --- /dev/null +++ b/scripts/check_upstream.sh | |||
@@ -0,0 +1,19 @@ | |||
1 | # check git repo $1 if upstream branch | ||
2 | # origin/master is ahead of local branch $2(default to dev) | ||
3 | check_upstream() { | ||
4 | |||
5 | head='dev' | ||
6 | if [ $# -eq 2 ] | ||
7 | then | ||
8 | head=$2 | ||
9 | fi | ||
10 | |||
11 | cd ~/$1 | ||
12 | git fetch origin && \ | ||
13 | git rev-list $head | grep $(git rev-parse origin/master) > /dev/null | ||
14 | |||
15 | if [ $? -ne 0 ] | ||
16 | then | ||
17 | echo "New commit at" $1 | ||
18 | fi | ||
19 | } | ||
diff --git a/scripts/sync-vimwiki.cron b/scripts/sync-vimwiki.cron new file mode 100644 index 0000000..c99487f --- /dev/null +++ b/scripts/sync-vimwiki.cron | |||
@@ -0,0 +1 @@ | |||
0 * * * * cd ~/vimwiki && git add * && git commit -am "update" && git push | |||
diff --git a/scripts/sync.sh b/scripts/sync.sh new file mode 100755 index 0000000..26abc22 --- /dev/null +++ b/scripts/sync.sh | |||
@@ -0,0 +1,9 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | DIR="$(cd "$(dirname "$0")" && pwd)" | ||
4 | source $DIR/check_upstream.sh | ||
5 | |||
6 | cd ~/git/settings && git pull --quiet & | ||
7 | cd ~/vimwiki && git pull --quiet & | ||
8 | check_upstream git/tig & | ||
9 | check_upstream .vim_runtime & | ||