gl-setup: dont try to 'git add' and all that when no key was provided

Apparently some people want gitolite-admin as a non-repo.  Completely
outside gitolite, managed by puppet or such, and leaving only symlinks
for 'conf' and 'keydir' in $GL_ADMINDIR.

But then when they have to run 'gl-setup', the 'git add' complains about
the symlink.  Hence this patch.

----

Meanwhile, if you're one of those puppet masters, here's the script I
gave them for the *compile* (this has nothing to do with this patch; I'm
just throwing it in here so I won't lose it):

    #!/bin/bash

    # let's say you install using "non-root" method.  (Adjust GL_BINDIR for root
    # method or package method).

    # install normally, then make changes directly in $GL_ADMINDIR/conf and
    # $GL_ADMINDIR/keydir.  (Please leaves "logs/" and "hooks/" alone).

    # Then run this:

    export GL_ADMINDIR=$HOME/.gitolite
    export GL_BINDIR=$HOME/bin
    export GL_RC=$HOME/.gitolite.rc

    cd $GL_ADMINDIR
    $GL_BINDIR/gl-compile-conf

    # BE SURE TO REMOVE THE ADMIN REPO ITSELF FROM conf/gitolite.conf, as well as
    # repositories/gitolite-admin.git, lest a push by someone end up overwriting
    # this hand- (or machine-) crafted config.

    # you can get away even further from gitolite's control.  You can, for
    # example, set GL_NO_SETUP_AUTHKEYS in the rc file, and manage even the keys
    # yourself.  Just put the full path to $GL_BINDIR/gl-auth-command followed by
    # the username in the "command=" part of the authkeys file you generate.
This commit is contained in:
Sitaram Chamarty 2011-11-28 22:48:59 +05:30
parent bd789c029b
commit d08aca63ff

View file

@ -124,7 +124,7 @@ touch $HOME/.ssh/authorized_keys
gl-compile-conf -q
# setup push-to-admin
(
[ -n "$pubkey_file" ] && (
cd $HOME; cd $REPO_BASE/gitolite-admin.git
GIT_WORK_TREE=$GL_ADMINDIR; export GIT_WORK_TREE
git add conf/gitolite.conf keydir
@ -142,3 +142,5 @@ gl-install -q
# the never-ending quest to help with bloody ssh issues...
cd $GL_ADMINDIR/keydir
[ -n "$pubkey_file" ] && $GL_BINDIR/sshkeys-lint < $HOME/.ssh/authorized_keys -q -a $admin_name
exit 0