regproj: improve push creation success output
[girocco/ztw.git] / update.sh
blob7f1515c5b19d95fc3d2d1bbf0d31781eba91ee7a
1 #!/bin/bash
3 export PATH=/home/pasky/bin:$PATH
5 set -e
7 log="$(mktemp -t repomgr-XXXXXX)"
8 proj="$1"
9 cd "$proj.git"
10 url="$(cat base_url)"
11 mail="$(cat owner)"
13 bang() {
14 if ! "$@" >>"$log" 2>&1; then
15 if ! [ -e .banged ]; then
17 echo "$* failed with error code $?"
18 echo "you will not receive any more notifications until recovery"
19 echo "Log follows:"
20 cat "$log"
21 } | mail -s "[repo.or.cz] $proj update failed" "$mail",pasky@ucw.cz
23 touch .banged
24 rm "$log"
25 exit 1
29 GIT_DIR=. bang git mirror "$url"
30 GIT_DIR=. bang git update-server-info
31 date -R >.last_refresh
32 #cat $log
33 rm "$log"
34 if [ -e .banged ]; then
35 echo "$proj update succeeded - failure recovery" | mail -s "[repo.or.cz] $proj update succeeded" "$mail",pasky@ucw.cz
36 rm .banged