diff --git a/src/ga-post-update-hook b/src/ga-post-update-hook index 8090b8a..91d2bfb 100755 --- a/src/ga-post-update-hook +++ b/src/ga-post-update-hook @@ -1,10 +1,7 @@ #!/bin/sh -# get this from your .gitolite.conf; and don't forget this is shell, while -# that is perl :-) -export GL_ADMINDIR; GL_ADMINDIR=$HOME/.gitolite - # checkout the master branch to $GL_ADMINDIR +# (the GL_ADMINDIR env var would have been set by gl-auth-command) GIT_WORK_TREE=$GL_ADMINDIR git checkout -f master # remove all fragments. otherwise, you get spurious error messages when you @@ -31,4 +28,4 @@ do done cd $GL_ADMINDIR -src/gl-compile-conf +$GL_BINDIR/gl-compile-conf diff --git a/src/gl-auth-command b/src/gl-auth-command index 86fec88..12b3234 100755 --- a/src/gl-auth-command +++ b/src/gl-auth-command @@ -39,6 +39,11 @@ require "$bindir/gitolite.pm"; &where_is_rc(); die "parse $ENV{GL_RC} failed: " . ($! or $@) unless do $ENV{GL_RC}; +# we need to pass GL_ADMINDIR and the bindir to the child hooks (well only the +# admin repo's post-update hook but still...) +$ENV{GL_ADMINDIR} = $GL_ADMINDIR; +$ENV{GL_BINDIR} = $bindir; + # add a custom path for git binaries, if specified $ENV{PATH} .= ":$GIT_PATH" if $GIT_PATH; diff --git a/src/gl-compile-conf b/src/gl-compile-conf index 138249d..ab1155c 100755 --- a/src/gl-compile-conf +++ b/src/gl-compile-conf @@ -73,7 +73,7 @@ $ENV{PATH} .= ":$GIT_PATH" if $GIT_PATH; # ---------------------------------------------------------------------------- # command and options for authorized_keys -$AUTH_COMMAND="$GL_ADMINDIR/src/gl-auth-command"; +$AUTH_COMMAND="$bindir/gl-auth-command"; $AUTH_OPTIONS="no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty"; # groups can now represent user groups or repo groups. diff --git a/src/gl-easy-install b/src/gl-easy-install index db20e2f..d73c82d 100755 --- a/src/gl-easy-install +++ b/src/gl-easy-install @@ -48,7 +48,7 @@ main() { [[ $upgrade == 0 ]] && initial_conf_key # MANUAL: cd to $GL_ADMINDIR and run "src/gl-compile-conf" - ssh -p $port $user@$host "cd $GL_ADMINDIR; src/gl-compile-conf $quiet" + ssh -p $port $user@$host "cd $GL_ADMINDIR; \$PWD/src/gl-compile-conf $quiet" setup_pta diff --git a/src/gl-install b/src/gl-install index a4dc729..9494fc6 100755 --- a/src/gl-install +++ b/src/gl-install @@ -79,8 +79,6 @@ for my $repo (`find . -type d -name "*.git"`) { if ( -d "gitolite-admin.git/hooks" ) { print "copying post-update hook to gitolite-admin repo...\n"; system("cp $GL_ADMINDIR/src/ga-post-update-hook gitolite-admin.git/hooks/post-update"); - system("perl", "-i", "-p", "-e", "s(GL_ADMINDIR=.*)(GL_ADMINDIR=$GL_ADMINDIR)", - "gitolite-admin.git/hooks/post-update"); chmod 0755, "gitolite-admin.git/hooks/post-update"; }