usertool.pl: allow specifying old email for email change
[girocco/readme.git] / jobs / updateweb.sh
blobad2f87bd52a9fa7f9d5ff96bd3b79d186316cf31
1 #!/bin/sh
3 . @basedir@/shlib.sh
5 set -e
7 REPO_DIR="/home/repo/repo"
8 LOCK_FILE="/tmp/updateweb-$cfg_tmpsuffix.lock"
9 REMOTE="origin"
10 BRANCH="rorcz"
12 # Make sure we don't run twice.
13 if [ -s "$LOCK_FILE" ] && kill -0 "$(cat "$LOCK_FILE")" 2>/dev/null; then
14 echo "Already running updateweb.sh (stuck?) with pid $(cat "$LOCK_FILE")" >&2
15 exit 1
17 trap 'rm -f "$LOCK_FILE"' EXIT
18 trap 'exit 130' INT
19 trap 'exit 143' TERM
20 echo $$ >"$LOCK_FILE"
22 cd "$REPO_DIR"
23 git fetch origin
24 if [ -n "$(git rev-list $BRANCH..$REMOTE/$BRANCH)" ]; then
25 case "$(git describe --always --dirty=..dirty)" in *..dirty)
26 echo "updateweb.sh: refusing to update because worktree is dirty" >&2
27 rm -f "$LOCK_FILE"
28 exit 1
29 esac
30 git merge --ff-only "$REMOTE/$BRANCH" &&
31 git submodule update --init --recursive &&
32 make -s &&
33 make install || :
36 rm -f "$LOCK_FILE"
37 trap - EXIT INT TERM