completely EXPERIMENTAL -> BETA
[girocco/ztw.git] / update.sh
blobb2293858a9079b32c96f4a0181631183e875fb0d
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
16 echo "$* failed with error code $?"
17 echo "Log follows:"
18 cat "$log"
19 } | mail -s "[repo.or.cz] $proj update failed" "$mail",pasky@ucw.cz
20 rm "$log"
21 exit 1
25 GIT_DIR=. bang git fetch -f -u -k --mirror-all "$url"
26 [ "$(ls objects/??/* 2>/dev/null)" ] && GIT_DIR=. bang git repack -a -d
27 GIT_DIR=. bang git update-server-info
28 date --rfc >.last_refresh
29 #cat $log
30 rm "$log"