From fa18779239db0812846a1bb383359d7eab272697 Mon Sep 17 00:00:00 2001 From: djk Date: Thu, 7 Jan 1999 22:54:41 +0000 Subject: [PATCH] modified create_sysop.pl to allow update --- Changes | 2 + perl/create_sysop.pl | 112 ++++++++++++++++++++++++------------------- 2 files changed, 66 insertions(+), 48 deletions(-) diff --git a/Changes b/Changes index 2b3b13df..54c11360 100644 --- 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!) diff --git a/perl/create_sysop.pl b/perl/create_sysop.pl index 4696fc2e..fbeca272 100755 --- a/perl/create_sysop.pl +++ b/perl/create_sysop.pl @@ -11,70 +11,86 @@ # 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 = ; - create_it() if ($ans =~ /^[Yy]/); + print "Do you wish to destroy your user database (THINK!!!) [y/N]: "; + $ans = ; + if ($ans =~ /^[Yy]/) { + delete_it(); + create_it(); + } else { + print "Do you wish to reset your cluster and sysop information? [y/N]: "; + $ans = ; + create_it() if $ans =~ /^[Yy]/; + } + } else { - create_it(); + create_it(); } +DXUser->finish(); exit(0); -- 2.43.0