dsp/autoupdate

32 lines
581 B
Text
Raw Normal View History

2015-10-18 23:06:39 -07:00
#!/usr/bin/env zsh
set -e
alias db="dropbox_uploader"
rm -r lib
2015-10-19 05:49:28 -07:00
db -q download py/lib
2015-10-18 23:06:39 -07:00
if [ ! -d .git ]; then
2015-10-19 05:49:28 -07:00
git -q init
2015-10-18 23:06:39 -07:00
[ -e version ] && rm version
git add .gitignore '*' '**/*'
else
2015-10-19 05:39:37 -07:00
git add -A
2015-10-18 23:47:00 -07:00
changes="$(git status --porcelain | wc -l)"
[ "$changes" -eq 0 ] && exit 0
2015-10-18 23:06:39 -07:00
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
2015-10-19 05:49:28 -07:00
git commit -qm "update $version" . >/dev/null
2015-10-19 05:47:32 -07:00
2015-10-19 05:53:43 -07:00
if git remote | grep -Fxq origin; then
git push -q origin master
fi