diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 09:55:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 09:55:51 +0000 |
commit | 7685305e1f82212323ec32a321b1f5c623751b6c (patch) | |
tree | a1af617672e26aee4c1031a3aa83e8ff08f6a0a5 /check-g2-compat | |
parent | Initial commit. (diff) | |
download | gitolite3-7685305e1f82212323ec32a321b1f5c623751b6c.tar.xz gitolite3-7685305e1f82212323ec32a321b1f5c623751b6c.zip |
Adding upstream version 3.6.12.upstream/3.6.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'check-g2-compat')
-rwxr-xr-x | check-g2-compat | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/check-g2-compat b/check-g2-compat new file mode 100755 index 0000000..508c6fd --- /dev/null +++ b/check-g2-compat @@ -0,0 +1,99 @@ +#!/usr/bin/perl + +use Cwd; + +my $h = $ENV{HOME}; +my $rc = "$h/.gitolite.rc"; +my %count; + +intro(); + +msg( FATAL => "no rc file found; do you even *have* g2 running?" ) if not -f $rc; +do $rc; +unless ( $return = do $rc ) { + msg( FATAL => "couldn't parse $rc: $@" ) if $@; + msg( FATAL => "couldn't do $rc: $!" ) unless defined $return; + msg( WARNING => "couldn't run $rc" ) unless $return; +} + +print "checking rc file...\n"; +rc_basic(); +rest_of_rc(); +print "\n"; + +print "checking conf file(s)...\n"; +conf(); +print "\n"; + +print "checking repos...\n"; +repo(); +print "\n"; + +print "...all done...\n"; + +# ---------------------------------------------------------------------- + +sub intro { + msg( INFO => "This program only checks for uses that make the new g3 completely unusable" ); + msg( '' => "or that might end up giving *more* access to someone if migrated as-is." ); + msg( '' => "It does NOT attempt to catch all the differences described in the docs." ); + msg( '', '' ); + msg( INFO => "'see docs' usually means the pre-migration checklist in" ); + msg( '', => "'g2migr.html'; to get there, start from the main migration" ); + msg( '', => "page at http://gitolite.com/gitolite/migr.html" ); + msg( '', '' ); +} + +sub rc_basic { + msg( FATAL => "GL_ADMINDIR in the wrong place -- aborting; see docs" ) if $GL_ADMINDIR ne "$h/.gitolite"; + msg( NOTE => "GL_ADMINDIR is in the right place; assuming you did not mess with" ); + msg( '', "GL_CONF, GL_LOGT, GL_KEYDIR, and GL_CONF_COMPILED" ); + msg( FATAL => "REPO_BASE in the wrong place -- aborting; see docs" ) if $REPO_BASE ne "$h/repositories" and $REPO_BASE ne "repositories"; +# ( abs or rel both ok) +} + +sub rest_of_rc { + msg( SEVERE => "GIT_PATH found; see docs" ) if $GIT_PATH; + msg( SEVERE => "GL_ALL_INCLUDES_SPECIAL found; see docs" ) if $GL_ALL_INCLUDES_SPECIAL; + msg( SEVERE => "GL_NO_CREATE_REPOS not yet implemented" ) if $GL_NO_CREATE_REPOS; + msg( SEVERE => "rsync not yet implemented" ) if $RSYNC_BASE; + msg( WARNING => "ADMIN_POST_UPDATE_CHAINS_TO found; see docs" ) if $ADMIN_POST_UPDATE_CHAINS_TO; + msg( WARNING => "GL_NO_DAEMON_NO_GITWEB found; see docs" ) if $GL_NO_DAEMON_NO_GITWEB; + msg( WARNING => "GL_NO_SETUP_AUTHKEYS found; see docs" ) if $GL_NO_SETUP_AUTHKEYS; + msg( WARNING => "UPDATE_CHAINS_TO found; see docs" ) if $UPDATE_CHAINS_TO; + msg( WARNING => "GL_ADC_PATH found; see docs" ) if $GL_ADC_PATH; + msg( WARNING => "non-default GL_WILDREPOS_PERM_CATS found" ) if $GL_WILDREPOS_PERM_CATS ne 'READERS WRITERS'; +} + +sub conf { + chdir($h); + chdir($GL_ADMINDIR); + + my $conf = `find . -name "*.conf" | xargs cat`; + msg( "SEVERE", "NAME rules; see docs" ) if $conf =~ m(NAME/); + msg( "SEVERE", "subconf command in admin repo; see docs" ) if $conf =~ m(NAME/conf/fragments); + msg( "SEVERE", "mirroring used; see docs" ) if $conf =~ m(config +gitolite\.mirror\.); +} + +sub repo { + chdir($h); + chdir($REPO_BASE); + my @creater = `find . -name gl-creater`; + if (@creater) { + msg( WARNING => "found " . scalar(@creater) . " gl-creater files; see docs" ); + } + + my @perms = `find . -name gl-perms | xargs egrep -l -w R\\|RW`; + if (@perms) { + msg( WARNING => "found " . scalar(@perms) . " gl-perms files with R or RW; see docs" ); + } +} + +sub msg { + my ( $type, $text ) = @_; + print "$type" if $type; + print "\t$text\n"; + exit 1 if $type eq 'FATAL'; + + $count{$type}++ if $type; +} |