]> dxcluster.org Git - spider.git/commitdiff
modified create_sysop.pl to allow update
authordjk <djk>
Thu, 7 Jan 1999 22:54:41 +0000 (22:54 +0000)
committerdjk <djk>
Thu, 7 Jan 1999 22:54:41 +0000 (22:54 +0000)
Changes
perl/create_sysop.pl

diff --git a/Changes b/Changes
index 2b3b13dfa4edd3497f3dfa3198a9f46efdea4e98..54c113601a0152be03473b50476a8c15d3809f14 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 07Jan99========================================================================
 1. Fixed Geomag after emacs reformatted it wrong so sh/wwv works again.
 2. Added more range checking in WWV spots (they really are a heap of ...)
+3. Changed create_sysop.pl so that you can update as well as create the user 
+file
 06Jan99========================================================================
 1. Do some range checking for spots and WWV in the future (got a WWV for Oct 
 2034 whhich caused a bit of confusion!)
index 4696fc2e505633f723568594e363a60f43a7bf64..fbeca2727ef34bc923a34d549b790a2bf7857954 100755 (executable)
 
 # make sure that modules are searched in the order local then perl
 BEGIN {
-  # root of directory tree for this system
-  $root = "/spider"; 
-  $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
+       # 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";
+       unshift @INC, "$root/local";
 }
 
 use DXVars;
 use DXUser;
 
+sub delete_it
+{
+       system("rm -f $userfn*");
+}
+
 sub create_it
 {
-  system("rm -f $userfn*");
-  DXUser->init($userfn);
-  my $self = DXUser->new($mycall);
-  $self->{alias} = $myalias;
-  $self->{name} = $myname;
-  $self->{qth} = $myqth;
-  $self->{qra} = $mylocator;
-  $self->{lat} = $mylatitude;
-  $self->{long} = $mylongtitude;
-  $self->{email} = $myemail;
-  $self->{bbsaddr} = $mybbsaddr;
-  $self->{homenode} = $mycall;
-  $self->{sort} = 'A';           # C - Console user, S - Spider cluster, A - AK1A, U - User, B - BBS
-  $self->{priv} = 9;             # 0 - 9 - with 9 being the highest
-  $self->{lastin} = 0;
-  $self->{dxok} = 1;
-  $self->{annok} = 1;
+       my $ref = DXUser->get($mycall);
+       $ref->del() if $ref;
+       
+       my $self = DXUser->new($mycall);
+       $self->{alias} = $myalias;
+       $self->{name} = $myname;
+       $self->{qth} = $myqth;
+       $self->{qra} = $mylocator;
+       $self->{lat} = $mylatitude;
+       $self->{long} = $mylongtitude;
+       $self->{email} = $myemail;
+       $self->{bbsaddr} = $mybbsaddr;
+       $self->{homenode} = $mycall;
+       $self->{sort} = 'A';            # C - Console user, S - Spider cluster, A - AK1A, U - User, B - BBS
+       $self->{priv} = 9;                      # 0 - 9 - with 9 being the highest
+       $self->{lastin} = 0;
+       $self->{dxok} = 1;
+       $self->{annok} = 1;
 
-  # write it away
-  $self->close();
+       # write it away
+       $self->close();
 
-  # now do one for the alias
-  $self = DXUser->new($myalias);
-  $self->{name} = $myname;
-  $self->{qth} = $myqth;
-  $self->{qra} = $mylocator;
-  $self->{lat} = $mylatitude;
-  $self->{long} = $mylongtitude;
-  $self->{email} = $myemail;
-  $self->{bbsaddr} = $mybbsaddr;
-  $self->{homenode} = $mycall;
-  $self->{sort} = 'U';           # C - Console user, S - Spider cluster, A - AK1A, U - User, B - BBS
-  $self->{priv} = 9;             # 0 - 9 - with 9 being the highest
-  $self->{lastin} = 0;
-  $self->{dxok} = 1;
-  $self->{annok} = 1;
-  $self->{lang} = 'en';
+       # now do one for the alias
+       $ref = DXUser->get($myalias);
+       $ref->del() if $ref;
+
+       $self = DXUser->new($myalias);
+       $self->{name} = $myname;
+       $self->{qth} = $myqth;
+       $self->{qra} = $mylocator;
+       $self->{lat} = $mylatitude;
+       $self->{long} = $mylongtitude;
+       $self->{email} = $myemail;
+       $self->{bbsaddr} = $mybbsaddr;
+       $self->{homenode} = $mycall;
+       $self->{sort} = 'U';            # C - Console user, S - Spider cluster, A - AK1A, U - User, B - BBS
+       $self->{priv} = 9;                      # 0 - 9 - with 9 being the highest
+       $self->{lastin} = 0;
+       $self->{dxok} = 1;
+       $self->{annok} = 1;
+       $self->{lang} = 'en';
   
-  # write it away
-  $self->close();
+       # write it away
+       $self->close();
 
-  DXUser->finish();
-  print "New user database created as $userfn\n";
 }
 
+DXUser->init($userfn);
 if (-e "$userfn") {
-  print "This program will destroy your user database!!!!\n\nDo you wish to continue [y/N]: ";
-  $ans = <STDIN>;
-  create_it() if ($ans =~ /^[Yy]/);
+       print "Do you wish to destroy your user database (THINK!!!) [y/N]: ";
+       $ans = <STDIN>;
+       if ($ans =~ /^[Yy]/) {
+               delete_it();
+               create_it();
+       } else {
+               print "Do you wish to reset your cluster and sysop information? [y/N]: ";
+               $ans = <STDIN>;
+               create_it() if $ans =~ /^[Yy]/;
+       }
+  
 } else {
-  create_it();
+       create_it();
 }
+DXUser->finish();
 exit(0);