From a0ffdb3aa02441c07e281642ff6d6ad2f9c9eed4 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 14 Feb 2014 21:46:18 -0800 Subject: [PATCH] Add new update-all-hooks.sh toolbox utility New projects are created by copying the hook scripts into the new project's hooks subdirectory. If the hook scripts are subsequently updated, any projects with out-of-date hook scripts may not work properly. This utility will update all the out-of-date hooks for all the projects currently listed in the chroot's etc/group file. --- toolbox/update-all-hooks.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 toolbox/update-all-hooks.sh diff --git a/toolbox/update-all-hooks.sh b/toolbox/update-all-hooks.sh new file mode 100755 index 0000000..4382dd0 --- /dev/null +++ b/toolbox/update-all-hooks.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Update all out-of-date hooks in all current projects + +set -e + +. @basedir@/shlib.sh + +base="$cfg_reporoot" +hookbin="$cfg_basedir/hooks" +cut -d : -f 1 < "$cfg_chroot/etc/group" | grep -v _repo | \ +( + while read proj; do + projdir="$base/$proj.git" + updates= + for hook in post-receive update post-update; do + if [ -f "$projdir/hooks/$hook" ]; then + if ! cmp -s "$hookbin/$hook" "$projdir/hooks/$hook"; then + cat "$hookbin/$hook" > "$projdir/hooks/$hook" + updates="$updates $hook" + fi + fi + done + [ -z "$updates" ] || echo "$proj:$updates" + done +) -- 2.11.4.GIT