X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=perl%2Fcluster.pl;h=0db8e0bcb2e0d59354f276a41a5c2a21c098e333;hb=f1b140502b1f92947977490d9e4688b24a2f82c1;hp=81e23cf874ce35c04561f725f5f8768a382495e4;hpb=c664bf735ebbf814c651b6d9d94fbd5abb8cd15c;p=spider.git diff --git a/perl/cluster.pl b/perl/cluster.pl index 81e23cf8..0db8e0bc 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -12,6 +12,11 @@ require 5.004; +package main; + +# set default paths, these should be overwritten by DXVars.pm +use vars qw($data $system $cmd $localcmd $userfn); + # make sure that modules are searched in the order local then perl BEGIN { umask 002; @@ -30,6 +35,11 @@ BEGIN { mkdir "$root/local_cmd", 0777 unless -d "$root/local_cmd"; + $data = "$root/data"; + $system = "$root/sys"; + $cmd = "$root/cmd"; + $localcmd = "$root/local_cmd"; + $userfn = "$data/users"; # try to create and lock a lockfile (this isn't atomic but # should do for now @@ -387,7 +397,7 @@ if (DXSql::init($dsn)) { # determine the real version number my $repo = Git->repository(Directory => "$root/.git"); if ($repo) { - my $desc = $repo->command_oneline(['describe', '--long'], STDERR => 0); + my $desc = $repo->command_oneline(['describe'], STDERR => 0); if ($desc) { my ($v, $s, $b, $g) = $desc =~ /^([\d.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/; $version = $v; @@ -423,13 +433,24 @@ Bands::load(); dbg("loading user file system ..."); DXUser->init($userfn, 1); + # look for the sysop and the alias user and complain if they aren't there { die "\$myalias \& \$mycall are the same ($mycall)!, they must be different (hint: make \$mycall = '${mycall}-2';). Oh and don't forget to rerun create_sysop.pl!" if $mycall eq $myalias; my $ref = DXUser::get($mycall); die "$mycall missing, run the create_sysop.pl script and please RTFM" unless $ref && $ref->priv == 9; + my $oldsort = $ref->sort; + if ($oldsort ne 'S') { + $ref->sort('S'); + dbg "Resetting node type from $oldsort -> DXSpider ('S')"; + } $ref = DXUser::get($myalias); die "$myalias missing, run the create_sysop.pl script and please RTFM" unless $ref && $ref->priv == 9; + $oldsort = $ref->sort; + if ($oldsort ne 'U') { + $ref->sort('U'); + dbg "Resetting sysop user type from $oldsort -> User ('U')"; + } } # start listening for incoming messages/connects