2009-10-02 19:53:52 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-10-20 12:10:17 +02:00
|
|
|
die() { echo "$@" >&2; exit 1; }
|
2011-06-19 03:24:52 +02:00
|
|
|
|
2011-01-15 16:39:56 +01:00
|
|
|
[ -z "$GL_RC" ] && die "ENV GL_RC not set"
|
|
|
|
[ -z "$GL_BINDIR" ] && die "ENV GL_BINDIR not set"
|
|
|
|
[ -z "$GL_ADMINDIR" ] && die "ENV GL_ADMINDIR not set"
|
|
|
|
|
2010-04-20 15:31:05 +02:00
|
|
|
# ensure that the admin is not sneaking in src/ and hooks/ :)
|
|
|
|
GIT_WORK_TREE=$GL_ADMINDIR git ls-tree --name-only master |
|
|
|
|
perl -lne 'exit 1 if /^(src|hooks)$/' || {
|
|
|
|
echo "*** ERROR ***" >&2
|
|
|
|
echo "no files/dirs called 'src' or 'hooks' are allowed, sorry" >&2
|
|
|
|
echo "until those files are deleted, the post-update hook will not run" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2009-10-03 09:47:02 +02:00
|
|
|
# checkout the master branch to $GL_ADMINDIR
|
2009-12-15 08:05:48 +01:00
|
|
|
# (the GL_ADMINDIR env var would have been set by gl-auth-command)
|
2011-01-29 01:46:13 +01:00
|
|
|
GIT_WORK_TREE=$GL_ADMINDIR git checkout -f --quiet master
|
2009-10-03 09:47:02 +02:00
|
|
|
|
2010-03-30 14:23:40 +02:00
|
|
|
od=$PWD
|
2009-10-03 09:47:02 +02:00
|
|
|
cd $GL_ADMINDIR
|
2009-12-15 08:05:48 +01:00
|
|
|
$GL_BINDIR/gl-compile-conf
|
2010-03-16 14:56:26 +01:00
|
|
|
|
2010-03-30 14:23:40 +02:00
|
|
|
cd $od
|
2010-03-17 16:06:51 +01:00
|
|
|
|
2011-01-15 16:39:56 +01:00
|
|
|
ADMIN_POST_UPDATE_CHAINS_TO=`$GL_BINDIR/gl-query-rc ADMIN_POST_UPDATE_CHAINS_TO`
|
2010-04-13 14:56:34 +02:00
|
|
|
[ -n "$ADMIN_POST_UPDATE_CHAINS_TO" ] || ADMIN_POST_UPDATE_CHAINS_TO=hooks/post-update.secondary
|
|
|
|
|
2011-05-28 16:56:55 +02:00
|
|
|
if [ -x $ADMIN_POST_UPDATE_CHAINS_TO ]
|
2010-03-16 14:56:26 +01:00
|
|
|
then
|
2010-04-13 14:56:34 +02:00
|
|
|
exec $ADMIN_POST_UPDATE_CHAINS_TO "$@"
|
2010-03-16 14:56:26 +01:00
|
|
|
fi
|