allow syslog facility to be changed
[gitolite.git] / check-g2-compat
blob508c6fd2e3627790ef0e0285890ca8169ba8522a
1 #!/usr/bin/perl
3 use Cwd;
5 my $h = $ENV{HOME};
6 my $rc = "$h/.gitolite.rc";
7 my %count;
9 intro();
11 msg( FATAL => "no rc file found; do you even *have* g2 running?" ) if not -f $rc;
12 do $rc;
13 unless ( $return = do $rc ) {
14 msg( FATAL => "couldn't parse $rc: $@" ) if $@;
15 msg( FATAL => "couldn't do $rc: $!" ) unless defined $return;
16 msg( WARNING => "couldn't run $rc" ) unless $return;
19 print "checking rc file...\n";
20 rc_basic();
21 rest_of_rc();
22 print "\n";
24 print "checking conf file(s)...\n";
25 conf();
26 print "\n";
28 print "checking repos...\n";
29 repo();
30 print "\n";
32 print "...all done...\n";
34 # ----------------------------------------------------------------------
36 sub intro {
37 msg( INFO => "This program only checks for uses that make the new g3 completely unusable" );
38 msg( '' => "or that might end up giving *more* access to someone if migrated as-is." );
39 msg( '' => "It does NOT attempt to catch all the differences described in the docs." );
40 msg( '', '' );
41 msg( INFO => "'see docs' usually means the pre-migration checklist in" );
42 msg( '', => "'g2migr.html'; to get there, start from the main migration" );
43 msg( '', => "page at http://gitolite.com/gitolite/migr.html" );
44 msg( '', '' );
47 sub rc_basic {
48 msg( FATAL => "GL_ADMINDIR in the wrong place -- aborting; see docs" ) if $GL_ADMINDIR ne "$h/.gitolite";
49 msg( NOTE => "GL_ADMINDIR is in the right place; assuming you did not mess with" );
50 msg( '', "GL_CONF, GL_LOGT, GL_KEYDIR, and GL_CONF_COMPILED" );
51 msg( FATAL => "REPO_BASE in the wrong place -- aborting; see docs" ) if $REPO_BASE ne "$h/repositories" and $REPO_BASE ne "repositories";
52 # ( abs or rel both ok)
55 sub rest_of_rc {
56 msg( SEVERE => "GIT_PATH found; see docs" ) if $GIT_PATH;
57 msg( SEVERE => "GL_ALL_INCLUDES_SPECIAL found; see docs" ) if $GL_ALL_INCLUDES_SPECIAL;
58 msg( SEVERE => "GL_NO_CREATE_REPOS not yet implemented" ) if $GL_NO_CREATE_REPOS;
59 msg( SEVERE => "rsync not yet implemented" ) if $RSYNC_BASE;
60 msg( WARNING => "ADMIN_POST_UPDATE_CHAINS_TO found; see docs" ) if $ADMIN_POST_UPDATE_CHAINS_TO;
61 msg( WARNING => "GL_NO_DAEMON_NO_GITWEB found; see docs" ) if $GL_NO_DAEMON_NO_GITWEB;
62 msg( WARNING => "GL_NO_SETUP_AUTHKEYS found; see docs" ) if $GL_NO_SETUP_AUTHKEYS;
63 msg( WARNING => "UPDATE_CHAINS_TO found; see docs" ) if $UPDATE_CHAINS_TO;
64 msg( WARNING => "GL_ADC_PATH found; see docs" ) if $GL_ADC_PATH;
65 msg( WARNING => "non-default GL_WILDREPOS_PERM_CATS found" ) if $GL_WILDREPOS_PERM_CATS ne 'READERS WRITERS';
68 sub conf {
69 chdir($h);
70 chdir($GL_ADMINDIR);
72 my $conf = `find . -name "*.conf" | xargs cat`;
73 msg( "SEVERE", "NAME rules; see docs" ) if $conf =~ m(NAME/);
74 msg( "SEVERE", "subconf command in admin repo; see docs" ) if $conf =~ m(NAME/conf/fragments);
75 msg( "SEVERE", "mirroring used; see docs" ) if $conf =~ m(config +gitolite\.mirror\.);
78 sub repo {
79 chdir($h);
80 chdir($REPO_BASE);
81 my @creater = `find . -name gl-creater`;
82 if (@creater) {
83 msg( WARNING => "found " . scalar(@creater) . " gl-creater files; see docs" );
86 my @perms = `find . -name gl-perms | xargs egrep -l -w R\\|RW`;
87 if (@perms) {
88 msg( WARNING => "found " . scalar(@perms) . " gl-perms files with R or RW; see docs" );
92 sub msg {
93 my ( $type, $text ) = @_;
94 print "$type" if $type;
95 print "\t$text\n";
96 exit 1 if $type eq 'FATAL';
98 $count{$type}++ if $type;