move ganerated stuff to local_data
authorDirk Koopman <djk@tobit.co.uk>
Tue, 16 Aug 2016 23:46:27 +0000 (00:46 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 16 Aug 2016 23:46:27 +0000 (00:46 +0100)
Mega change to push all local data in $root/local_data and where there
is duplication with system data (still in $root/data) then use whichever
is newer. This will move stuff (permanently) like spots and other DXLog
files to local_data as well as the userfile, DX QSL file and usdb stuff.

34 files changed:
Changes
cmd/bye.pl
cmd/crontab
cmd/export_users.pl
perl/BadWords.pm
perl/Bands.pm
perl/DXDupe.pm
perl/DXHash.pm
perl/DXLog.pm
perl/DXProt.pm
perl/DXUser.pm
perl/DXUtil.pm
perl/DXVars.pm.issue
perl/ExtMsg.pm
perl/Geomag.pm
perl/Prefix.pm
perl/QSL.pm
perl/SysVar.pm [new file with mode: 0644]
perl/USDB.pm
perl/WCY.pm
perl/cluster.pl
perl/console.pl
perl/convert_users.pl [deleted file]
perl/create_prefix.pl
perl/create_qsl.pl
perl/create_sysop.pl
perl/gen_usdb_data.pl
perl/grepdbg
perl/hlptohtml.pl
perl/lock_nodes.pl
perl/talias.pl
perl/update_sysop.pl
perl/watchdbg
perl/winclient.pl

diff --git a/Changes b/Changes
index 0b307ae2e2609af6d0cbb510c3419aca059ef5f2..ee9be652cba0f41942e505d1efd717891a62a80b 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+16Aug16=======================================================================
+1. Mega change to push all local data in $root/local_data and where there
+   is duplication with system data (still in $root/data) then use whichever
+   is newer. This will move stuff (permanently) like spots and other DXLog
+   files to local_data as well as the userfile, DX QSL file and usdb stuff.
 25Jul16=======================================================================
 1. Add some timing stats to cmd spawn_cmd.
 08Jul16=======================================================================
index 41d3ee91af35a549d17dcfd57019b4c72ae82b75..513b3055af6fa4bca41f5b1d8bddef23de27f874 100644 (file)
@@ -8,8 +8,8 @@ my $self = shift;
 return (1, $self->msg('e5')) if $self->inscript;
 
 # log out text
-if ($self->is_user && -e "$main::data/logout") {
-       open(I, "$main::data/logout") or confess;
+if ($self->is_user && -e localdata("logout")) {
+       open(I, localdata("logout")) or confess;
        my @in = <I>;
        close(I);
        $self->send_now('D', @in);
index f971764c7a59be0981f52068f011f9519658baf4..4343d76b39e0a5872affca8ccd8b71a899163342 100644 (file)
@@ -5,6 +5,6 @@
 # create and edit the one in /spider/local_cmd/crontab
 # for doing connections and things
 #
-1 0 * * 3 DXUser::export("$main::data/user_asc")
+1 0 * * 3 DXUser::export(localdata("user_asc"))
 5 0 * * * DXDebug::dbgclean()
 0 3 * * * Spot::daily()
index a8cec7de3b074614b5a2f4add19b3b3c944d3df8..a7a2c6ec50fe06c35d16308022801cbbb7b03f3e 100644 (file)
@@ -4,7 +4,7 @@
 #
 #
 my $self = shift;
-my $line = shift || "$main::data/user_asc";
+my $line = shift || localdata("user_asc");
 return (1, $self->msg('e5')) unless $self->priv >= 9;
 
 my ($fn, $flag) = split /\s+/, $line;
index 05a41bcc01aa15f1740e9a6545ace2e65d172156..141b3e9a729b6a933149cb0bf71bf4a942938285 100644 (file)
@@ -19,9 +19,9 @@ use IO::File;
 
 use vars qw($badword $regexcode);
 
-my $oldfn = "$main::data/badwords";
-my $regex = "$main::data/badw_regex";
-my $bwfn = "$main::data/badword";
+my $oldfn = localdata("badwords");
+my $regex = localdata("badw_regex");
+my $bwfn = localdata("badword");
 
 # copy issue ones across
 filecopy("$regex.gb.issue", $regex) unless -e $regex;
index 9f44c09005d160851eed237cb4b2c893afdf5756..cc67dc234da5b5ed13331143d26e039b39be993f 100644 (file)
@@ -18,7 +18,7 @@ use vars qw(%bands %regions %aliases $bandsfn %valid);
 %bands = ();                                   # the 'raw' band data
 %regions = ();                                 # list of regions for shortcuts eg vhf ssb
 %aliases = ();                                 # list of aliases
-$bandsfn = "$main::data/bands.pl";
+$bandsfn = localdata("bands.pl");
 
 %valid = (
                  cw => '0,CW,parraypairs',
index 5b288d1f87b1b3f1d04f8f99caf8c485d3d0127f..ebb2aac41a7c157f5be5986c9384cce2143a399a 100644 (file)
@@ -17,7 +17,8 @@ use vars qw{$lasttime $dbm %d $default $fn};
 
 $default = 48*24*60*60;
 $lasttime = 0;
-$fn = "$main::data/dupefile";
+localdata_mv("dupefile");
+$fn = localdata("dupefile");
 
 sub init
 {
index 1e3c833e0dfa5d7d7b1f842d426a38d322645d97..cf9f05211c202ff10cd42798f22542822921dd36 100644 (file)
@@ -8,7 +8,7 @@
 # Things entered into the list are always upper
 # cased.
 # 
-# The files that are created live in /spider/data
+# The files that are created live in /spider/local_data (was data)
 # 
 # Dunno why I didn't do this earlier but heyho..
 #
@@ -28,7 +28,10 @@ use strict;
 sub new
 {
        my ($pkg, $name) = @_;
-       my $s = readfilestr($main::data, $name);
+
+       # move existing file
+       localdata_mv($name);
+       my $s = readfilestr($main::local_data, $name);
        my $self = undef;
        $self = eval $s if $s;
        dbg("error in reading $name in DXHash $@") if $@;
@@ -39,7 +42,7 @@ sub new
 sub put
 {
        my $self = shift;
-       writefilestr($main::data, $self->{name}, undef, $self);
+       writefilestr($main::local_data, $self->{name}, undef, $self);
 }
 
 sub add
index 1113bc247b2d0a58d412d80104a18987320cb225..9ec12fd3916f6eb044d3b5949eedba4c36223197 100644 (file)
@@ -49,7 +49,8 @@ sub new
 {
        my ($prefix, $suffix, $sort) = @_;
        my $ref = bless {}, __PACKAGE__;
-       $ref->{prefix} = "$main::data/$prefix";
+       localdata_mv($prefix);
+       $ref->{prefix} = "$main::local_data/$prefix";
        $ref->{suffix} = $suffix if $suffix;
        $ref->{sort} = $sort;
        
index 7064dc7f84736a7e8bd1f51880dd0846b06d0b57..37e4c1dcafa7eda37c8de7db38eb7715f08ac22e 100644 (file)
@@ -232,7 +232,8 @@ sub update_pc92_keepalive
 
 sub init
 {
-       do "$main::data/hop_table.pl" if -e "$main::data/hop_table.pl";
+       my $fn = localdata("hop_table.pl");
+       do $fn if -e $fn;
        confess $@ if $@;
 
        my $user = DXUser::get($main::mycall);
index 432507462e5048b51620d271e45307e19300f40c..dd31e6f632fffac6003e11bf3b700c8275cfb28b 100644 (file)
@@ -16,6 +16,7 @@ use IO::File;
 use DXDebug;
 use DXUtil;
 use LRU;
+use File::Copy;
 
 use strict;
 
@@ -115,10 +116,8 @@ sub AUTOLOAD
 #
 sub init
 {
-       my ($pkg, $fn, $mode) = @_;
+       my $mode = shift;
   
-       confess "need a filename in User" if !$fn;
-
        my $ufn;
        my $convert;
        
@@ -126,10 +125,10 @@ sub init
                require Storable;
        };
 
-#      eval "use Storable qw(nfreeze thaw)";
+       my $fn = "users";
        
        if ($@) {
-               $ufn = "$fn.v2";
+               $ufn = localdata("users.v2");
                $v3 = $convert = 0;
                dbg("the module Storable appears to be missing!!");
                dbg("trying to continue in compatibility mode (this may fail)");
@@ -137,9 +136,9 @@ sub init
        } else {
                import Storable qw(nfreeze thaw);
 
-               $ufn = "$fn.v3";
+               $ufn = localdata("users.v3");
                $v3 = 1;
-               $convert++ if -e "$fn.v2" && !-e $ufn;
+               $convert++ if -e localdata("users.v2") && !-e $ufn;
        }
        
        if ($mode) {
@@ -159,7 +158,7 @@ sub init
                my %oldu;
                dbg("Converting the User File to V3 ");
                dbg("This will take a while, I suggest you go and have cup of strong tea");
-               my $odbm = tie (%oldu, 'DB_File', "$fn.v2", O_RDONLY, 0666, $DB_BTREE) or confess "can't open user file: $fn.v2 ($!) [rebuild it from user_asc?]";
+               my $odbm = tie (%oldu, 'DB_File', localdata("users.v2"), O_RDONLY, 0666, $DB_BTREE) or confess "can't open user file: $fn.v2 ($!) [rebuild it from user_asc?]";
         for ($action = R_FIRST; !$odbm->seq($key, $val, $action); $action = R_NEXT) {
                        my $ref = asc_decode($val);
                        if ($ref) {
@@ -178,9 +177,7 @@ sub init
 
 sub del_file
 {
-       my ($pkg, $fn) = @_;
-  
-       confess "need a filename in User" if !$fn;
+       my $fn = localdata("users");
        $fn .= $v3 ? ".v3" : ".v2";
        unlink $fn;
 }
@@ -457,7 +454,7 @@ BEGIN {
        
        # try to detect a lockfile (this isn't atomic but 
        # should do for now
-       $lockfn = "$root/local/cluster.lck";       # lock file name
+       $lockfn = "$root/local_data/cluster.lck";       # lock file name
        if (-e $lockfn) {
                open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
                my $pid = <CLLOCK>;
@@ -469,7 +466,7 @@ BEGIN {
 
 package DXUser;
 
-use DXVars;
+use SysVar;
 use DXUser;
 
 if (@ARGV) {
@@ -477,8 +474,8 @@ if (@ARGV) {
        print "user filename now $userfn\n";
 }
 
-DXUser->del_file($main::userfn);
-DXUser->init($main::userfn, 1);
+DXUser::del_file();
+DXUser::init();
 %u = ();
 my $count = 0;
 my $err = 0;
@@ -494,7 +491,7 @@ while (<DATA>) {
                $err++
        }
 }
-DXUser->sync; DXUser->finish;
+DXUser::sync; DXUser::finish;
 print "There are $count user records and $err errors\n";
 };
                print $fh "__DATA__\n";
index 4e442140b82e9394422492bc639f5d3fd6ed8903..b58a4528d5649bc60df8dbcd23e892e58bde30b5 100644 (file)
@@ -8,11 +8,13 @@
 
 package DXUtil;
 
+
 use Date::Parse;
 use IO::File;
 use File::Copy;
 use Data::Dumper;
 
+
 use strict;
 
 use vars qw(@month %patmap $pi $d2r $r2d @ISA @EXPORT);
@@ -24,7 +26,7 @@ require Exporter;
                         filecopy ptimelist
              print_all_fields cltounix unpad is_callsign is_long_callsign is_latlong
                         is_qra is_freq is_digits is_pctext is_pcflag insertitem deleteitem
-                        is_prefix dd is_ipaddr $pi $d2r $r2d
+                        is_prefix dd is_ipaddr $pi $d2r $r2d localdata localdata_mv
             );
 
 
@@ -472,3 +474,33 @@ sub deleteitem
        return $n - @$list;
 }
 
+# find the correct local_data directory
+# basically, if there is a local_data directory with this filename and it is younger than the
+# equivalent one in the (system) data directory then return that name rather than the system one
+sub localdata
+{
+       my $ifn = shift;
+       my $ofn = "$main::data/$ifn";
+       my $tfn;
+       
+       if (-e "$main::local_data") {
+               $tfn = "main::local_data/$ifn";
+               if (-e $tfn && -M $tfn < -M $ofn) {
+                       $ofn = $tfn;
+               }
+       }
+
+       return $ofn;
+}
+
+# move a file or a directory from data -> local_data if isn't there already
+sub localdata_mv
+{
+       my $ifn = shift;
+       if (-e "$main::data/$ifn" ) {
+               unless (-e "$main::local_data/$ifn") {
+                       move("$main::data/$ifn", "$main::local_data/$ifn") or die "localdata_mv: cannot move $ifn from '$main::data' -> '$main::local_data' $!\n";
+               }
+       }
+}
+
index 3f05a7b639ca18da495e34ef1a87736fafdf572e..b4058cf0271595bc53eaf89377cb103b792b2151 100644 (file)
@@ -64,23 +64,6 @@ $no = 'No';
 # the interval between unsolicited prompts if not traffic
 $user_interval = 11*60;
 
-# data files live in 
-$data = "$root/data";
-
-# system files live in
-$system = "$root/sys";
-
-# command files live in
-$cmd = "$root/cmd";
-
-# local command files live in (and overide $cmd)
-$localcmd = "$root/local_cmd";
-
-# where the user data lives
-$userfn = "$data/users";
-
-# the "message of the day" file
-$motd = "$data/motd";
 
 # are we debugging ?
 @debug = qw(chan state msg cron connect);
index 0188e49c76bb16af614f161361407fec9f222420..ffa16bb711e92257ba185aef822b95b00236a480 100644 (file)
@@ -152,7 +152,7 @@ sub to_connected
        delete $conn->{timeout};
        $conn->{csort} = $sort;
        &{$conn->{rproc}}($conn, "$dir$call|$sort");
-       $conn->_send_file("$main::data/connected") unless $conn->{outgoing};
+       $conn->_send_file(localdata("connected")) unless $conn->{outgoing};
 }
 
 sub new_client {
@@ -162,7 +162,7 @@ sub new_client {
        my $conn = $server_conn->SUPER::new_client($client);
        # send login prompt
        $conn->{state} = 'WL';
-       $conn->_send_file("$main::data/issue");
+       $conn->_send_file(localdata("issue"));
        $conn->send_raw("login: ");
        $conn->_dotimeout(60);
        $conn->{echo} = 1;
index 881ab9d6a83fa4217393b6f3aedf3a2b0407c2b5..3447743ffafc76a47b14e60481630006db1efddc 100644 (file)
@@ -38,7 +38,7 @@ $from = "";                                           # who this came from
 $duplth = 20;                                  # the length of text to use in the deduping
 $dupage = 12*3600;                             # the length of time to hold spot dups
 
-$dirprefix = "$main::data/wwv";
+$dirprefix = "$main::local_data/wwv";
 $param = "$dirprefix/param";
 
 $filterdef = bless ([
index 53424e03e00e7e40cbae01f02e56f354b1b2cadf..fd361ebaaa178865211561087c26ae47eb7bf6d2 100644 (file)
@@ -72,7 +72,8 @@ sub load
        # tie the main prefix database
        eval {$db = tie(%pre, "DB_File", undef, O_RDWR|O_CREAT, 0664, $DB_BTREE);};
        my $out = "$@($!)" if !$db || $@ ;
-       eval {do "$main::data/prefix_data.pl" if !$out; };
+       my $fn = localdata("prefix_data.pl");
+       eval {do $fn if !$out; };
        $out .= $@ if $@;
        $lru = LRU->newbase('Prefix', $lrusize);
 
@@ -88,7 +89,7 @@ sub store
 {
        my ($k, $l);
        my $fh = new IO::File;
-       my $fn = "$main::data/prefix_data.pl";
+       my $fn = localdata("prefix_data.pl");
   
        confess "Prefix system not started" if !$db;
   
index 20d5c6143f139e656ab3a4c325fa7a1872fa78da..1738ed6ed67831072d1a97754717a22b100898e0 100644 (file)
@@ -18,10 +18,12 @@ use vars qw($qslfn $dbm);
 $qslfn = 'qsl';
 $dbm = undef;
 
+localdata_mv("$qslfn.v1");
+
 sub init
 {
        my $mode = shift;
-       my $ufn = "$main::root/data/$qslfn.v1";
+       my $ufn = localdata("$qslfn.v1");
 
        Prefix::load() unless Prefix::loaded();
        
diff --git a/perl/SysVar.pm b/perl/SysVar.pm
new file mode 100644 (file)
index 0000000..92a81e4
--- /dev/null
@@ -0,0 +1,39 @@
+# These are a load of system variables that used to live in DXVars.pm.
+#
+# They have been broken out into a separate module which must be called AFTER 'use DXVars' if that is in fact called at all.
+#
+# It is a replacement for DXVars.pm wherever it is used just for these paths
+#
+
+package main;
+use warnings;
+
+##
+## DXVars.pm overrides
+##
+# data files live in 
+$data = "$root/data";
+
+# for local data
+$local_data = "$root/local_data";
+
+# system files live in (except they don't, not really)
+$system = "$root/sys";
+
+# command files live in
+$cmd = "$root/cmd";
+
+# local command files live in (and overide $cmd)
+$localcmd = "$root/local_cmd";
+
+# data files live in 
+$data = "$root/data";
+
+# for local data
+$local_data = "$root/local_data";
+
+# where the user data lives
+$userfn = "$local_data/users";
+
+# the "message of the day" file
+$motd = "$local_data/motd";
index 042e9190f4538ac64e26b3171904c309a220986d..478763efb534bb511a4e38c5bf056fa9cccc1c59 100644 (file)
@@ -13,11 +13,14 @@ use DXVars;
 use DB_File;
 use File::Copy;
 use DXDebug;
+use DXUtil;
+
 #use Compress::Zlib;
 
 use vars qw(%db $present $dbfn);
 
-$dbfn = "$main::data/usdb.v1";
+localdata_mv("usdb.v1");
+$dbfn = localdata("usdb.v1");
 
 sub init
 {
index f18950b6dd9b50a07659bbb1c492b881205d35d6..826208e5332edf7604335ece130726410307bf5d 100644 (file)
@@ -39,7 +39,7 @@ $from = "";                                           # who this came from
 $duplth = 20;                                  # the length of text to use in the deduping
 $dupage = 12*3600;                             # the length of time to hold spot dups
 
-$dirprefix = "$main::data/wcy";
+$dirprefix = "$main::local_data/wcy";
 $param = "$dirprefix/param";
 
 $filterdef = bless ([
@@ -55,7 +55,6 @@ $filterdef = bless ([
                          ['origin_zone', 'nz', 19],
                         ], 'Filter::Cmd');
 
-
 sub init
 {
        $fp = DXLog::new('wcy', 'dat', 'm');
index fc530e21c1db11b12f554ab43514f33a8e1f01fa..86785a9777c45c8ae0a4284ec1a0b86c9b84d3da 100755 (executable)
@@ -10,6 +10,8 @@
 #
 #
 
+package main;
+
 require 5.10.1;
 use warnings;
 
@@ -29,12 +31,13 @@ BEGIN {
        die "$root/local doesn't exist, please RTFM" unless -d "$root/local";
        die "$root/local/DXVars.pm doesn't exist, please RTFM" unless -e "$root/local/DXVars.pm";
 
-       mkdir "$root/local_cmd", 0777 unless -d "$root/local_cmd";
-
+       # create some directories
+       mkdir "$root/local_cmd", 02777 unless -d "$root/local_cmd";
+       mkdir "$root/local_data", 02777 unless -d "$root/local_data";
 
        # try to create and lock a lockfile (this isn't atomic but
        # should do for now
-       $lockfn = "$root/local/cluster.lck";       # lock file name
+       $lockfn = "$root/local_data/cluster.lck";       # lock file name
        if (-w $lockfn) {
                open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
                my $pid = <CLLOCK>;
@@ -56,6 +59,8 @@ BEGIN {
 use Mojo::IOLoop;
 
 use DXVars;
+use SysVar;
+
 use Msg;
 use IntMsg;
 use Internet;
@@ -148,7 +153,6 @@ our $ending;                                        # signal that we are ending;
 our $broadcast_debug;                  # allow broadcasting of debug info down "enhanced" user connections
 
 
-
 # send a message to call on conn and disconnect
 sub already_conn
 {
@@ -439,6 +443,7 @@ sub setup_start
        }
        STDOUT->autoflush(1);
 
+       
        # try to load the database
        if (DXSql::init($dsn)) {
                $dbh = DXSql->new($dsn);
@@ -495,7 +500,7 @@ sub setup_start
 
        # initialise User file system
        dbg("loading user file system ...");
-       DXUser->init($userfn, 1);
+       DXUser::init(1);
 
        # look for the sysop and the alias user and complain if they aren't there
        {
index 720d25752f92b2a2f21319029eb67ee7afa8aed9..854f3835eb6c03fd2ba7130aaab0fea498d54b67 100755 (executable)
@@ -29,9 +29,11 @@ BEGIN {
 
 use Mojo::IOLoop;
 
+use DXVars;
+use SysVar;
+
 use Msg;
 use IntMsg;
-use DXVars;
 use DXDebug;
 use DXUtil;
 use DXDebug;
diff --git a/perl/convert_users.pl b/perl/convert_users.pl
deleted file mode 100755 (executable)
index dbf9fb0..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/usr/bin/env perl
-#
-# Export the user file in a form that can be directly imported
-# back with a do statement
-#
-
-require 5.004;
-
-# search local then perl directories
-BEGIN {
-       umask 002;
-       
-       # root of directory tree for this system
-       $root = "/spider"; 
-       $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
-       
-       unshift @INC, "$root/perl";     # this IS the right way round!
-       unshift @INC, "$root/local";
-}
-
-use DXVars;
-use DB_File;
-use Fcntl;
-use Carp;
-
-$userfn = $ARGV[0] if @ARGV;
-unless ($userfn) {
-       croak "need a filename";
-}
-
-DXUser->init($userfn);
-unlink "$userfn.asc";
-open OUT, ">$userfn.asc" or die;
-
-%newu = ();
-$t = scalar localtime;
-print OUT "#!/usr/bin/perl
-#
-# The exported userfile for a DXSpider System
-# 
-# Input file: $userfn
-#       Time: $t
-#
-
-package DXUser;
-
-%u = (
-";
-
-@all = DXUser::get_all_calls();
-
-for $a (@all) {
-       my $ref = DXUser::get($a);
-       my $s = $ref->encode() if $ref;
-       print OUT "'$a' => q{$s},\n" if $a;
-       $count++;
-}
-
-DXUser->finish();
-
-print OUT ");
-#
-# there were $count records
-#\n";
-
-       close(OUT);
-
-exit(0);
-
-
-package DXUser;
-
-
-use MLDBM qw(DB_File);
-use Fcntl;
-use Carp;
-
-#
-# initialise the system
-#
-sub init
-{
-       my ($pkg, $fn, $mode) = @_;
-  
-       confess "need a filename in User" if !$fn;
-       if ($mode) {
-               $dbm = tie (%u, MLDBM, $fn, O_CREAT|O_RDWR, 0666) or confess "can't open user file: $fn ($!)";
-       } else {
-               $dbm = tie (%u, MLDBM, $fn, O_RDONLY) or confess "can't open user file: $fn ($!)";
-       }
-       
-       $filename = $fn;
-}
-
-#
-# close the system
-#
-
-sub finish
-{
-       untie %u;
-}
-
-#
-# get - get an existing user - this seems to return a different reference everytime it is
-#       called - see below
-#
-
-sub get
-{
-       my $pkg = shift;
-       my $call = uc shift;
-       #  $call =~ s/-\d+$//o;       # strip ssid
-       return $u{$call};
-}
-
-#
-# get all callsigns in the database 
-#
-
-sub get_all_calls
-{
-       return (sort keys %u);
-}
-
-
-# 
-# create a string from a user reference
-#
-sub encode
-{
-       my $self = shift;
-       my $out;
-       my $f;
-
-       $out = "bless( { ";
-       for $f (sort keys %$self) {
-               my $val = $$self{$f};
-           if (ref $val) {          # it's an array (we think)
-                       $out .= "'$f'=>[ ";
-                       foreach (@$val) {
-                               my $s = $_;
-                               $out .= "'$s',";
-                       }
-                       $out .= " ],";
-           } else {
-                       $val =~ s/'/\\'/og;
-                       $val =~ s/\@/\\@/og;
-                       $out .= "'$f'=>'$val',";
-               }
-       }
-       $out .= " }, 'DXUser')";
-       return $out;
-}
-
index 43501eea55e03f5ea4d1596ce6e975d2a5eca38e..daf4a09e409171cb1433b068aa9aa9a8c1d218c6 100755 (executable)
@@ -13,13 +13,18 @@ BEGIN {
        # root of directory tree for this system
        $root = "/spider"; 
        $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
-       
+
+       mkdir "$root/local_data", 02777 unless -d "$root/local_data";
+
        unshift @INC, "$root/perl";     # this IS the right way round!
        unshift @INC, "$root/local";
 }
 
-use DXVars;
+use SysVar;
+
 use Data::Dumper;
+use DXUtil;
+
 use strict;
 
 my %loc = ();                                          # the location unique hash
@@ -28,9 +33,17 @@ my %locn = ();                                               # the inverse of the above
 my %pre = ();                                          # the prefix hash
 my %pren = ();                                         # the inverse
 
+if (@ARGV && $ARVG[0] =~ /^--system$/) {
+       $prefix = $main::data;
+       shift;
+} else {
+       $prefix = $main:local_data;
+}
+
 # open the input file
 my $ifn = $ARGV[0] if $ARGV[0];
-$ifn = "$main::data/wpxloc.raw" if !$ifn;
+
+$ifn = "$prefix/wpxloc.raw" if !$ifn;
 open (IN, $ifn) or die "can't open $ifn ($!)";
 
 # first pass, find all the 'master' location records
@@ -94,7 +107,7 @@ close(IN);
 my @f;
 my @a;
 $line = 0;
-if (open(IN, "$main::data/cty.dat")) {
+if (open(IN, "$prefix/cty.dat")) {
        my $state = 0;
        while (<IN>) {
                $line++;
@@ -125,7 +138,7 @@ if (open(IN, "$main::data/cty.dat")) {
 close IN;
 
 
-open(OUT, ">$main::data/prefix_data.pl") or die "Can't open $main::data/prefix_data.pl ($!)";
+open(OUT, ">$prefix/prefix_data.pl") or die "Can't open $prefix/prefix_data.pl ($!)";
 
 print OUT "\%pre = (\n";
 foreach my $k (sort keys %pre) {
index 2cca7b31386cd80986bc5ea2e54f331cbbc866b9..f4083f55d0adb7f1ec146f61e4f7b79bbe732255 100755 (executable)
@@ -22,7 +22,7 @@ BEGIN {
 use strict;
 
 use IO::File;
-use DXVars;
+use SysVar;
 use DXUtil;
 use Spot;
 use QSL;
@@ -36,11 +36,12 @@ my $qslfn = "qsl";
 
 $main::systime = time;
 
-unlink "$root/data/qsl.v1";
+unlink "$data/qsl.v1";
+unlink "$local_data/qsl.v1";
 
 QSL::init(1) or die "cannot open QSL file";
 
-my $base = "$root/data/spots";
+my $base = localdata("spots");
 
 opendir YEAR, $base or die "$base $!";
 foreach my $year (sort readdir YEAR) {
index 31c208b0381379b6386bd578b3a3c83cb5c42332..b85c60b770677b0f7cebadae00d1a2c017182b5b 100755 (executable)
@@ -19,12 +19,13 @@ BEGIN {
        unshift @INC, "$root/local";
 }
 
-use DXVars;
+use SysVar;
 use DXUser;
+use DXUtil;
 
 sub delete_it
 {
-       DXUser->del_file($userfn);
+       DXUser::del_file();
 }
 
 sub create_it
@@ -79,7 +80,7 @@ sub create_it
 
 die "\$myalias \& \$mycall are the same ($mycall)!, they must be different (hint: make \$mycall = '${mycall}-2';).\n" if $mycall eq $myalias;
 
-$lockfn = "$root/local/cluster.lck";       # lock file name
+$lockfn = localdata("cluster.lck");       # lock file name
 if (-e $lockfn) {
        open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
        my $pid = <CLLOCK>;
@@ -95,21 +96,21 @@ if (-e "$userfn.v2" || -e "$userfn.v3") {
        $ans = <STDIN>;
        if ($ans =~ /^[Yy]/) {
                delete_it();
-               DXUser->init($userfn, 1);
+               DXUser::init(1);
                create_it();
        } else {
                print "Do you wish to reset your cluster and sysop information? [y/N]: ";
                $ans = <STDIN>;
                if ($ans =~ /^[Yy]/) {
-                       DXUser->init($userfn, 1);
+                       DXUser::init(1);
                        create_it();
                }
        }
   
 } else {
-       DXUser->init($userfn, 1);
+       DXUser::init(1);
        create_it();
 }
-DXUser->finish();
+DXUser::finish();
 exit(0);
 
index 7c9d47e2c189c7dec02300d18c87ae236f6b6777..7857a5c534695ddec9f4d7f3206deabe7c4d39e7 100755 (executable)
@@ -36,11 +36,14 @@ BEGIN {
        $root = "/spider"; 
        $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
 
+       mkdir "$root/local_data", 02777 unless -d "$root/local_data";
+
        unshift @INC, "$root/perl";     # this IS the right way round!
        unshift @INC, "$root/local";
 }
 
-use DXVars;
+use SysVar;
+
 use Archive::Zip qw(:ERROR_CODES);
 use Archive::Zip::MemberRead;
 use IO::File;
@@ -50,7 +53,7 @@ my $blksize = 1024 * 1024;
 
 STDOUT->autoflush(1);
 
-my $dbrawfn = "$main::data/usdbraw.gz";
+my $dbrawfn = localdata("usdbraw.gz");
 
 rename "$dbrawfn.oo", "$dbrawfn.ooo";
 rename "$dbrawfn.o", "$dbrawfn.oo";
@@ -75,7 +78,7 @@ sub handleEN
 {
        my ($zip, $argv) = @_;
        my $mname = "EN.dat";
-       my $ofn = "$main::data/$mname";
+       my $ofn = localdata($mname);
        print "  Handling EN records, unzipping";
        if ($zip->extractMember($mname, $ofn) == AZ_OK) {
                my $fh = new IO::File "$ofn" or die "Cannot open $ofn $!";
index 3d1526f8d70b93446548ee9257ce7b0c87349484..ebf581bd50a5b33d745229ebabd6a3523df3b6f9 100755 (executable)
@@ -29,7 +29,7 @@ BEGIN {
        unshift @INC, "$root/local";
 }
 
-use DXVars;
+use SysVar;
 use DXUtil;
 use DXLog;
 use Julian;
index 9bebb9c00ec3b9ae4dfd0fd52801020184eb6c8b..6b48df2b63b2f506960149547faac8aa67d43dcc 100755 (executable)
@@ -21,7 +21,7 @@ BEGIN {
 
 use strict;
 use IO::File;
-use DXVars;
+use SysVar;
 use Carp;
 
 my $lang = 'en';
index 0afad397684ade63d3cac25c0d902cff821cebfa..3ab0e7d170cae50401120a20f609aafa1b3554c7 100755 (executable)
@@ -1,13 +1,9 @@
 #!/usr/bin/env perl
 #
-# remove all records with the sysop/cluster callsign and recreate
-# it from the information contained in DXVars
+# Lock all non local nodes that have a privileges <= 1
 #
 # WARNING - this must be run when the cluster.pl is down!
 #
-# This WILL NOT delete an old sysop call if you are simply
-# changing the callsign.
-#
 # Copyright (c) 1998 Dirk Koopman G1TLH
 #
 #
@@ -23,10 +19,11 @@ BEGIN {
        unshift @INC, "$root/local";
 }
 
-use DXVars;
+use SysVar;
 use DXUser;
+use DXUtil;
 
-my $lockfn = "$root/local/cluster.lck";       # lock file name
+my $lockfn = localdata("cluster.lck");       # lock file name
 if (-e $lockfn) {
        open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
        my $pid = <CLLOCK>;
@@ -37,7 +34,7 @@ if (-e $lockfn) {
 
 my @nodes = map { uc } @ARGV;
 
-DXUser->init($userfn, 1);
+DXUser::init(1);
 
 my $count;
 my $nodes;
@@ -71,6 +68,6 @@ print "If there are any nodes missing on the above list then you MUST do\n";
 print "a set/node (set/spider, set/clx etc) on each of them to allow them\n";
 print "to connect to you or you to them\n"; 
  
-DXUser->finish();
+DXUser::finish();
 exit(0);
 
index 1cf70e827e8bcd04fe3eb19d5a42cb8ad2e98174..c5dc83f9f640429b7a1321c4238012f9e95e6553 100755 (executable)
@@ -13,7 +13,7 @@ BEGIN {
   unshift @INC, "$root/local";
 }
 
-use DXVars;
+use SysVar;
 use CmdAlias;
 
 use Carp;
index f76dc7257faa71d9c10b89f380e4a7e51c8d2920..e7225c7c3c65ba49574426e2d58859a9dc863c17 100755 (executable)
@@ -22,8 +22,9 @@ BEGIN {
        unshift @INC, "$root/local";
 }
 
-use DXVars;
+use SysVar;
 use DXUser;
+use DXUtil;
 
 sub create_it
 {
@@ -85,7 +86,7 @@ sub create_it
 
 die "\$myalias \& \$mycall are the same ($mycall)!, they must be different (hint: make \$mycall = '${mycall}-2';).\n" if $mycall eq $myalias;
 
-$lockfn = "$root/local/cluster.lck";       # lock file name
+$lockfn = localdata("cluster.lck");       # lock file name
 if (-e $lockfn) {
        open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
        my $pid = <CLLOCK>;
@@ -94,9 +95,9 @@ if (-e $lockfn) {
        close CLLOCK;
 }
 
-DXUser->init($userfn, 1);
+DXUser::init(1);
 create_it();
-DXUser->finish();
+DXUser:finish();
 print "Update of $myalias on cluster $mycall successful\n";
 exit(0);
 
index 348ac8fe7bbbe5ab49101d635c429b9a66113ed3..3297941388ba5efecedad920b7f8bfcee3f6285b 100755 (executable)
@@ -23,7 +23,7 @@ BEGIN {
 }
 
 use IO::File;
-use DXVars;
+use SysVar;
 use DXUtil;
 use DXLog;
 
index f556b102707dbf7bcdfa02b2b052c43f629080c1..96898000701d404f4bf75d31d617eed29c809121 100755 (executable)
@@ -28,6 +28,8 @@ BEGIN {
 
 use IO::Socket;
 use DXVars;
+use SysVar;
+
 use IO::File;
 use Config;