dsp/autoupdate
2015-12-01 22:40:38 -08:00

31 lines
592 B
Bash
Executable file

#!/usr/bin/env zsh
set -e
alias db="dropbox_uploader"
rm -r lib
db -q download py/lib >/dev/null
if [ ! -d .git ]; then
git -q init
[ -e version ] && rm version
git add .gitignore '*' '**/*'
else
git add -A
changes="$(git status --porcelain | wc -l)"
[ "$changes" -eq 0 ] && exit 0
fi
if [ -s version ]; then
read -r version < version
else
version=0
fi
let version++ || true # -e mode doesn't like this normally
echo $version > version
git commit -qm "update $version" . >/dev/null
if git remote | grep -Fxq origin; then
git push -q origin master
fi