diff options
author | ivan <ivan> | 2000-02-03 05:17:39 +0000 |
---|---|---|
committer | ivan <ivan> | 2000-02-03 05:17:39 +0000 |
commit | 5bd5f206a77cf975515d955119d4dff7764a2d8c (patch) | |
tree | 1e344342389a47fe1b96e214ac757dfb5417f041 /bin | |
parent | 3bfec7cf75a1a4eb4da1cdf8c64003bd6babcd81 (diff) |
beginning of DNS and Apache support
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fs-setup | 34 | ||||
-rwxr-xr-x | bin/svc_acct.import | 9 | ||||
-rwxr-xr-x | bin/svc_acct_sm.import | 9 | ||||
-rw-r--r-- | bin/svc_domain.import | 92 |
4 files changed, 135 insertions, 9 deletions
diff --git a/bin/fs-setup b/bin/fs-setup index dcaccdf1c..b75058d55 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: fs-setup,v 1.22 2000-01-31 05:22:23 ivan Exp $ +# $Id: fs-setup,v 1.23 2000-02-03 05:16:52 ivan Exp $ # # ivan@sisd.com 97-nov-8,9 # @@ -32,7 +32,10 @@ # fix radius attributes ivan@sisd.com 98-sep-27 # # $Log: fs-setup,v $ -# Revision 1.22 2000-01-31 05:22:23 ivan +# Revision 1.23 2000-02-03 05:16:52 ivan +# beginning of DNS and Apache support +# +# Revision 1.22 2000/01/31 05:22:23 ivan # prepaid "internet cards" # # Revision 1.21 2000/01/30 06:03:26 ivan @@ -184,7 +187,7 @@ my($part_svc)=$dbdef->table('part_svc'); #because of svc_acct_pop #foreach (grep /^svc_/, $dbdef->tables) { #foreach (qw(svc_acct svc_acct_sm svc_charge svc_domain svc_wo)) { -foreach (qw(svc_acct svc_acct_sm svc_domain)) { +foreach (qw(svc_acct svc_acct_sm svc_domain svc_www)) { my($table)=$dbdef->table($_); my($col); foreach $col ( $table->columns ) { @@ -653,6 +656,31 @@ sub tables_hash_hack { 'index' => [ [] ], }, + 'domain_record' => { + 'columns' => [ + 'recnum', 'int', '', '', + 'svcnum', 'int', '', '', + 'reczone', 'varchar', '', $char_d, + 'recaf', 'char', '', 2, + 'rectype', 'char', '', 5, + 'recdata', 'varchar', '', $char_d, + ], + 'primary_key' => 'recnum', + 'unique' => [ [] ], + 'index' => [ ['svcnum'] ], + }, + + 'svc_www' => { + 'columns' => [ + 'svcnum', 'int', '', '', + 'recnum', 'int', '', '', + 'usersvc', 'int', '', '', + ], + 'primary_key' => 'svcnum', + 'unique' => [ [] ], + 'index' => [ [] ], + }, + #'svc_wo' => { # 'columns' => [ # 'svcnum', 'int', '', '', diff --git a/bin/svc_acct.import b/bin/svc_acct.import index 6541a9fd4..893a8298a 100755 --- a/bin/svc_acct.import +++ b/bin/svc_acct.import @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: svc_acct.import,v 1.7 1999-07-08 02:32:26 ivan Exp $ +# $Id: svc_acct.import,v 1.8 2000-02-03 05:16:52 ivan Exp $ # # ivan@sisd.com 98-mar-9 # @@ -17,7 +17,10 @@ # don't import /var/spool/freeside/conf/shells! ivan@sisd.com 98-aug-13 # # $Log: svc_acct.import,v $ -# Revision 1.7 1999-07-08 02:32:26 ivan +# Revision 1.8 2000-02-03 05:16:52 ivan +# beginning of DNS and Apache support +# +# Revision 1.7 1999/07/08 02:32:26 ivan # import fix, noticed by Ben Leibig and Joel Griffiths # # Revision 1.6 1999/07/08 01:49:00 ivan @@ -263,6 +266,6 @@ foreach $username ( keys %upassword ) { # sub usage { - die "Usage:\n\n svc_acct.export user\n"; + die "Usage:\n\n svc_acct.import user\n"; } diff --git a/bin/svc_acct_sm.import b/bin/svc_acct_sm.import index bda9762e1..50b0f6702 100755 --- a/bin/svc_acct_sm.import +++ b/bin/svc_acct_sm.import @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: svc_acct_sm.import,v 1.4 1999-03-25 08:42:20 ivan Exp $ +# $Id: svc_acct_sm.import,v 1.5 2000-02-03 05:16:52 ivan Exp $ # # ivan@sisd.com 98-mar-9 # @@ -16,7 +16,10 @@ # ivan@sisd.com 98-jul-13 # # $Log: svc_acct_sm.import,v $ -# Revision 1.4 1999-03-25 08:42:20 ivan +# Revision 1.5 2000-02-03 05:16:52 ivan +# beginning of DNS and Apache support +# +# Revision 1.4 1999/03/25 08:42:20 ivan # import stuff uses Term::Query and spits out (some kinds of) nonsensical input # # Revision 1.3 1999/03/24 00:51:55 ivan @@ -278,6 +281,6 @@ END # sub usage { - die "Usage:\n\n svc_acct_sm.export user\n"; + die "Usage:\n\n svc_acct_sm.import user\n"; } diff --git a/bin/svc_domain.import b/bin/svc_domain.import new file mode 100644 index 000000000..329465ca1 --- /dev/null +++ b/bin/svc_domain.import @@ -0,0 +1,92 @@ +#!/usr/bin/perl -w +# +# $Id: svc_domain.import,v 1.1 2000-02-03 05:17:39 ivan Exp $ + +use strict; +use vars qw( %d_part_svc ); +use Term::Query qw(query); +use FS::SSH qw(iscp); +use FS::UID qw(adminsuidsetup datasrc); +#use FS::Record qw(qsearch qsearchs); +#use FS::svc_acct_sm; +use FS::svc_domain; +use FS::domain_record; +#use FS::svc_acct; +#use FS::part_svc; + +my $user = shift or die &usage; +adminsuidsetup $user; + +my($spooldir)="/usr/local/etc/freeside/export.". datasrc; + +%d_part_svc = + map { $_->svcpart, $_ } qsearch('part_svc',{'svcdb'=>'svc_domain'}); + +print "\n\n", + ( join "\n", map "$_: ".$d_part_svc{$_}->svc, sort keys %d_part_svc ), + "\n\n"; +$^W=0; #Term::Query isn't -w-safe +my $domain_svcpart = + query "Enter part number for domains: ", 'irk', [ keys %d_part_svc ]; +$^W=1; + + print "\n\n", <<END; +Enter the location and name of your primary named.conf file, for example +"ns.isp.com:/var/named/named.conf" +END + my($named_conf)=&getvalue(":"); + iscp("root\@$named_conf","$spooldir/named.conf.import"); + +my $named_machine = (split(/:/, $named_conf))[0]; + +print "\n\n"; + +## + +$FS::svc_domain::whois_hack=1; + +open(NAMED_CONF,"<$spooldir/named.conf.import") + or die "Can't open $spooldir/named.conf.import: $!"; + +while (<NAMED_CONF>) { + next unless /^\s*options/; +} +my $directory; +while (<NAMED_CONF>) { + last if /^\s*directory\s+\"([\/\w+]+)\";/; +} +$directory = $1 or die "can't locate directory in named.conf!"; +whlie (<NAMED_CONF>) { + next unless /^\s*zone\s+\"([\w\.\-]+)\"\s+\{/; + my $zone = $1; + while (<NAMED_CONF>) { + my $type; + if ( /^\s*type\s+(master|slave)\s*\;/ ) { + $type = $1; + } + if ( /^\s*file\s+\"([\w\.\-]+)\"\s*\;/ && $type eq 'master' ) { + + # + # (add svc_domain) + my $file = $1; + iscp("root\@$named_machine:$directory/$file","$spooldir/$file.import"); + open(ZONE,"<$spooldir/$file.import") + or die "Can't open $spooldir/$file.import: $!"; + while (<ZONE>) { + # (add domain_record) + } + + # + + } + + last if /^\s*\}\s*\;/; + } +} + +## + +sub usage { + die "Usage:\n\n svc_domain.import user\n"; +} + |