install.sh: Don't fail on non-existing $cfg_basedir
[girocco/mytab.git] / jobs / updatecheck.sh
blob3df2d0d48a5ea65f9f3be11d91288b47435fc6b1
1 #!/bin/bash
3 . @basedir@/shlib.sh
5 if [ -e /tmp/gitupdatelock ]; then
6 echo "Locked!" >&2
7 exit 1
8 fi
9 touch /tmp/gitupdatelock
11 # Repack in reverse order, so that forked repositories get repacked first.
12 # That prevents objects from missing, since repack -l will automagically
13 # put the now-going-away objects into the forked repository's object store.
15 cd "$cfg_reporoot"
16 get_repo_list_here | tac |
17 while read dir; do
18 # echo "+ `date` $dir"
19 if [ -e "$dir"/.nofetch ]; then
20 (cd "$dir/objects" && [ "$(ls ?? 2>/dev/null)" ] && git --git-dir=.. repack -a -l -d -q)
21 git --git-dir="$dir" update-server-info
22 else
23 "$cfg_basedir"/mirroring/update.sh "${dir%.git}"
25 # echo "- `date` $dir"
26 done 2>&1 | grep -v '^Pack.*created\.$'
28 rm /tmp/gitupdatelock