taskd/mail.sh: Take optional fourth parameter with project name
[girocco/testingthisout.git] / jobd / update.sh
blobb44499db7b5eae2eadc29a4d9726750d209b189c
1 #!/bin/bash
3 . @basedir@/shlib.sh
5 set -e
7 proj="$1"
8 cd "$cfg_reporoot/$proj.git"
10 if check_interval lastrefresh $cfg_min_mirror_interval; then
11 progress "= [$proj] update skip (last at $(config_get lastrefresh))"
12 exit 0
14 progress "+ [$proj] update (`date`)"
16 bang_setup
17 bang_once=1
18 bang_action="update"
20 url="$(config_get baseurl)"
21 mail="$(config_get owner)"
23 case "$url" in
24 svn://*)
25 GIT_DIR=. bang git svn fetch
26 GIT_DIR=. bang git fetch
29 bang git remote update
30 bang git remote prune origin
32 esac
34 bang git update-server-info
35 bang config_set lastrefresh "$(date -R)"
37 if [ -e .banged ]; then
38 echo "$proj update succeeded - failure recovery" | mail -s "[$cfg_name] $proj update succeeded" "$mail,$cfg_admin"
39 rm .banged
42 progress "- [$proj] update (`date`)"