diff --git a/src/gl-dryrun b/src/gl-dryrun new file mode 100755 index 0000000..a8b03fa --- /dev/null +++ b/src/gl-dryrun @@ -0,0 +1,118 @@ +#!/bin/bash + +die() { echo; echo "FATAL: $@"; usage; } + +usage() { + +cat < .gitolite/conf/VERSION + +# setup a minimal .gitolite.rc +export GL_RC=$PWD/gl_rc +cat > $GL_RC <<'EOF' +$GL_ADMINDIR=$ENV{PWD} . "/.gitolite"; +$GL_CONF="$GL_ADMINDIR/conf/gitolite.conf"; +$GL_KEYDIR="$GL_ADMINDIR/keydir"; +$GL_CONF_COMPILED="$GL_ADMINDIR/conf/gitolite.conf-compiled.pm"; +$GL_WILDREPOS = 0; +$PROJECTS_LIST = $ENV{PWD} . "/projects.list"; +$REPO_UMASK = 0077; +$GL_BIG_CONFIG = 0; +$GL_NO_DAEMON_NO_GITWEB = 1; +$GIT_PATH=""; +$GL_GITCONFIG_KEYS = ".*"; +$GL_NO_CREATE_REPOS = 1; +$GL_NO_SETUP_AUTHKEYS = 1; +$HTPASSWD_FILE = ""; +$RSYNC_BASE = ""; +$SVNSERVE = ""; +$GL_WILDREPOS_PERM_CATS = "READERS WRITERS"; +$GL_LOGT="$GL_ADMINDIR/logs/gitolite-%y-%m.log"; +$REPO_BASE="repositories"; +1; +EOF + +# now compile it +echo compiling... +$GL_BINDIR/gl-compile-conf +echo + +echo "checking if $admin has push rights..." +SSH_ORIGINAL_COMMAND=info $GL_BINDIR/gl-auth-command $admin +echo + +# now find out who has admin... +echo "checking what pubkeys (if any) have push rights..." +for f in `find .gitolite/keydir -name "*.pub" | sort` +do + f=$(basename $f) + u=$(perl -e '$u = shift; $u =~ s/(\@[^.]+)?\.pub$//; print $u' $f) + SSH_ORIGINAL_COMMAND=info $GL_BINDIR/gl-auth-command $u | grep R...W..gitolite-admin.$ > /dev/null && echo ' '$f +done +echo + +# now look for duplicate keys etc +echo "looking for (duplicate) pubkeys; they could cause later ones to be 'hidden'..." +cd .gitolite +for f in `find keydir -name "*.pub" | sort` +do + ssh-keygen -l -f "$f" +done | perl -ane ' + warn " $F[2] is hidden by $seen{$F[1]}\n" if $seen{$F[1]}; + $seen{$F[1]} = $F[2]; +' +cd .. +echo +