xinetd/git: add read-only user comments to sample
[girocco.git] / toolbox / update-all-hooks.sh
blob20540bdfe50d3bee7c0a0b66b1eda78357af21c3
1 #!/bin/sh
3 # Update all out-of-date hooks in all current projects and install missing ones
5 set -e
7 . @basedir@/shlib.sh
9 base="$cfg_reporoot"
10 hookbin="$cfg_basedir/hooks"
11 cut -d : -f 1 < "$cfg_chroot/etc/group" | grep -v _repo | \
13 while read proj; do
14 projdir="$base/$proj.git"
15 updates=
16 for hook in pre-receive post-receive update post-update; do
17 if [ -f "$projdir/hooks/$hook" ]; then
18 if ! cmp -s "$hookbin/$hook" "$projdir/hooks/$hook"; then
19 cat "$hookbin/$hook" > "$projdir/hooks/$hook"
20 updates="$updates $hook"
22 elif [ -d "$projdir/hooks" -a ! -e "$projdir/hooks/$hook" ]; then
23 cat "$hookbin/$hook" > "$projdir/hooks/$hook"
24 chmod 0775 "$projdir/hooks/$hook"
25 updates="$updates +$hook"
27 done
28 [ -z "$updates" ] || echo "$proj:$updates"
29 done