jobs/updateweb: use smarter update detection
[girocco.git] / jobs / updateweb.sh
blob7153d10e5cdc1f5879f6834c845ba1182e4b5a39
1 #!/bin/bash
3 set -e
5 REPO_DIR=/home/repo/repo
6 LOCK_FILE=/tmp/webupdate/lock
7 REMOTE=origin
8 BRANCH=rorcz
10 # Make sure we don't run twice.
11 if [ -s ${LOCK_FILE} ] && kill -0 $(cat ${LOCK_FILE}); then
12 echo "Already running (stuck?) with pid $(cat ${LOCK_FILE})" >&2
13 exit 1
15 echo $$ >${LOCK_FILE}
17 pushd ${REPO_DIR}
18 git fetch origin
19 if [ -z "`git rev-list $BRANCH..$REMOTE/$BRANCH`" ]; then
20 git merge $REMOTE/$BRANCH && make install
22 popd
24 rm ${LOCK_FILE}