2009-10-02 23:23:52 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
2011-10-20 15:40:17 +05:30
|
|
|
die() { echo "$@" >&2; exit 1; }
|
2011-06-19 06:54:52 +05:30
|
|
|
|
2011-01-15 21:09:56 +05:30
|
|
|
[ -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 19:01:05 +05:30
|
|
|
# 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 13:17:02 +05:30
|
|
|
# checkout the master branch to $GL_ADMINDIR
|
2009-12-15 12:35:48 +05:30
|
|
|
# (the GL_ADMINDIR env var would have been set by gl-auth-command)
|
2011-01-29 06:16:13 +05:30
|
|
|
GIT_WORK_TREE=$GL_ADMINDIR git checkout -f --quiet master
|
2009-10-03 13:17:02 +05:30
|
|
|
|
2010-03-30 17:53:40 +05:30
|
|
|
od=$PWD
|
2009-10-03 13:17:02 +05:30
|
|
|
cd $GL_ADMINDIR
|
2009-12-15 12:35:48 +05:30
|
|
|
$GL_BINDIR/gl-compile-conf
|
2010-03-16 19:26:26 +05:30
|
|
|
|
2010-03-30 17:53:40 +05:30
|
|
|
cd $od
|
2010-03-17 20:36:51 +05:30
|
|
|
|
2011-01-15 21:09:56 +05:30
|
|
|
ADMIN_POST_UPDATE_CHAINS_TO=`$GL_BINDIR/gl-query-rc ADMIN_POST_UPDATE_CHAINS_TO`
|
2010-04-13 18:26:34 +05:30
|
|
|
[ -n "$ADMIN_POST_UPDATE_CHAINS_TO" ] || ADMIN_POST_UPDATE_CHAINS_TO=hooks/post-update.secondary
|
|
|
|
|
2011-05-28 20:26:55 +05:30
|
|
|
if [ -x $ADMIN_POST_UPDATE_CHAINS_TO ]
|
2010-03-16 19:26:26 +05:30
|
|
|
then
|
2010-04-13 18:26:34 +05:30
|
|
|
exec $ADMIN_POST_UPDATE_CHAINS_TO "$@"
|
2010-03-16 19:26:26 +05:30
|
|
|
fi
|