version 1.52, 2007/04/03 22:13:40
|
version 1.58, 2007/05/22 23:16:47
|
Line 47 $|=1;
|
Line 47 $|=1;
|
********************************************* |
********************************************* |
|
|
END |
END |
sleep(3); |
#sleep(3); |
</perlscript> |
</perlscript> |
</file> |
</file> |
<file> |
<file> |
Line 421 my $lonAdmEMail;
|
Line 421 my $lonAdmEMail;
|
while (!$flag) { |
while (!$flag) { |
print(<<END); |
print(<<END); |
|
|
**** Server Administrator's E-mail **** |
**** Server Administrators E-mail **** |
E-mail address of the person who will manage this machine |
E-mail address of the person who will manage this machine |
[should be in the form somebody\@somewhere] |
[should be in the form somebody\@somewhere] |
ENTER ADMIN E-MAIL ADDRESS: |
ENTER ADMIN E-MAIL ADDRESS: |
Line 477 END
|
Line 477 END
|
|
|
# update loncapa.conf |
# update loncapa.conf |
my $confdir = '/etc/httpd/conf/'; |
my $confdir = '/etc/httpd/conf/'; |
if ('<DIST />' eq 'sles10' || '<DIST />' eq 'suse10.1') { |
if ('<DIST />' eq 'sles10' || '<DIST />' eq 'suse10.1' || '<DIST />' eq 'suse10.2') { |
$confdir = '/etc/apache2/'; |
$confdir = '/etc/apache2/'; |
} |
} |
my $filename='loncapa.conf'; |
my $filename='loncapa.conf'; |
Line 534 END
|
Line 534 END
|
</file> |
</file> |
<file> |
<file> |
<target dist='default'>/etc/httpd/conf/</target> |
<target dist='default'>/etc/httpd/conf/</target> |
<target dist='sles10 suse10.1'>/etc/apache2/</target> |
<target dist='sles10 suse10.1 suse10.2'>/etc/apache2/</target> |
<perlscript mode='fg'> |
<perlscript mode='fg'> |
sub securesetting { |
sub securesetting { |
my (%perlvar)=@_; |
my (%perlvar)=@_; |
Line 606 my %perlvarstatic;
|
Line 606 my %perlvarstatic;
|
} |
} |
close(CONFIG); |
close(CONFIG); |
} |
} |
if (!$domainDescription && $lonCluster ne 'existing') { |
|
open(IN,'<../'.$lonCluster.'_domain.tab'); |
my (@hosts_files, @domain_files); |
while(<IN>) { |
if ( $lonCluster ne 'existing') { |
if (/^$perlvar{'lonDefDomain'}\:/) { |
push(@domain_files,'../'.$lonCluster.'_domain.tab', |
(undef,$domainDescription,$domainTabExtras)=split(/:/,$_,3); |
'../'.$lonCluster.'_dns_domain.tab'); |
chomp($domainDescription); |
push(@hosts_files,'../'.$lonCluster.'_hosts.tab', |
chomp($domainTabExtras); |
'../'.$lonCluster.'_dns_hosts.tab'); |
# the remianing field (primary lib server) is handled later |
} |
$domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0..5]); |
push(@domain_files,'/home/httpd/lonTabs/domain.tab', |
last; |
'/home/httpd/lonTabs/dns_domain.tab'); |
} |
push(@hosts_files,'/home/httpd/lonTabs/hosts.tab', |
} |
'/home/httpd/lonTabs/dns_hosts.tab'); |
close(IN); |
|
} |
|
if (!$domainDescription) { |
if (!$domainDescription) { |
open(IN,'</home/httpd/lonTabs/domain.tab'); |
foreach my $file (@domain_files) { |
while(<IN>) { |
open(IN,'<'.$file); |
if (/^$perlvar{'lonDefDomain'}\:/) { |
while(my $line = <IN>) { |
(undef,$domainDescription,$domainTabExtras)=split(/:/,$_,3); |
if ($line =~ /^\Q$perlvar{'lonDefDomain'}\E\:/) { |
chomp($domainDescription); |
(undef,$domainDescription,$domainTabExtras)=split(/:/,$line,3); |
chomp($domainTabExtras); |
chomp($domainDescription); |
# the remianing field (primary lib server) is handled later |
chomp($domainTabExtras); |
$domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0..5]); |
# the remianing field (primary lib server) is handled later |
last; |
$domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0..5]); |
} |
last; |
} |
} |
close(IN); |
} |
|
close(IN); |
|
last if ($domainDescription); |
|
} |
} |
} |
if (!$primaryLibServer and $lonCluster ne 'existing') { |
|
open(IN,'<../'.$lonCluster.'_domain.tab'); |
while(!$primaryLibServ && (@hosts_file || @domain_files)) { |
while(<IN>) { |
my $file = shift(@domain_files); |
if (/^$perlvar{'lonDefDomain'}\:/) { |
open(IN,'<'.$file); |
(undef,undef,undef,undef,undef,undef,undef,undef, |
while(my $line = <IN>) { |
$primaryLibServer)=split(/:/,$_); |
if ($line =~ /^\Q$perlvar{'lonDefDomain'}\E\:/) { |
|
$primaryLibServer=(split(/:/,$line))[8]; |
chomp($primaryLibServer); |
chomp($primaryLibServer); |
} |
} |
} |
} |
close(IN); |
close(IN); |
if (!$primaryLibServer) { |
last if ($primaryLibServer); |
open(IN,'<../'.$lonCluster.'_hosts.tab'); |
$file = shift(@hosts_files); |
while(<IN>) { |
open(IN,'<'.$file); |
if (/^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) { |
while(my $line = <IN>) { |
push(@libservers,$1); |
if ($line =~ /^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) { |
} |
push(@libservers,$1); |
} |
} |
close(IN); |
} |
if (@libservers == 1) { |
# make list unique |
$primaryLibServer = $libservers[0]; |
@libservers = keys(%{{ map { $_ => 1 } (@libservers) }}); |
} |
close(IN); |
} |
if (@libservers == 1) { |
} |
$primaryLibServer = $libservers[0]; |
if (!$primaryLibServer) { |
} |
open(IN,'</home/httpd/lonTabs/domain.tab'); |
|
while(<IN>) { |
|
if (/^$perlvar{'lonDefDomain'}\:/) { |
|
(undef,undef,undef,undef,undef,undef,undef,undef, |
|
$primaryLibServer)=split(/:/,$_); |
|
chomp($primaryLibServer); |
|
} |
|
close(IN); |
|
} |
|
if (!$primaryLibServer) { |
|
open(IN,'</home/httpd/lonTabs/hosts.tab'); |
|
while(<IN>) { |
|
if (/^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) { |
|
push(@libservers,$1); |
|
} |
|
} |
|
close(IN); |
|
if (@libservers == 1) { |
|
$primaryLibServer = $libservers[0]; |
|
} |
|
} |
|
} |
} |
|
|
# implement editing logic below, interactively |
# implement editing logic below, interactively |
Line 705 This is now the current configuration of
|
Line 687 This is now the current configuration of
|
12) Everything is correct up above |
12) Everything is correct up above |
END |
END |
|
|
my $error=''; |
my @error; |
foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) { |
foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) { |
if (length($v)>35) { $error.="\nName $v too long"; } |
if (length($v)>35) { $error.="\nName $v too long"; } |
if (length($v)<2) { $error.="\nName $v too short"; } |
if (length($v)<2) { $error.="\nName $v too short"; } |
if ($v=~/capa/i) { |
if ($v=~/capa/i) { |
if ($v!~/^oucapa\d+$/ && |
if ($v!~/^oucapa\d+$/ && |
($v!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) { |
($v!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) { |
$error.="\nName $v contains 'capa'"; |
push(@error,"Name $v contains 'capa'"); |
} |
} |
} |
} |
foreach my $bad ('res','raw','userfiles','priv','adm','uploaded', |
foreach my $bad ('res','raw','userfiles','priv','adm','uploaded', |
'editupload') { |
'editupload') { |
$error.="\nName $v reserved." if $v eq $bad; |
push(@error,"\nName $v reserved.") if $v eq $bad; |
} |
} |
if ($v=~/[^\w\-.]/) { $error.="\nName $v contains special characters"; } |
if ($v=~/[^\w\-.]/) { push(@error,"Name $v contains special characters"); } |
} |
} |
if ($domainDescription!~/^[\(\)\-\w\s,]+$/) { |
if ($domainDescription =~ /^\s*$/) { |
$error.="\nDomain Description contains special characters"; |
push(@error,"Domain Description is blank."); |
|
} elsif ($domainDescription!~/^[\(\)\-\w\s,]+$/) { |
|
push(@error,"Domain Description contains special characters."); |
} |
} |
foreach my $v ($perlvar{'lonExpire'},$perlvar{'lonLoadLim'}) { |
foreach my $v ($perlvar{'lonExpire'},$perlvar{'lonLoadLim'}) { |
unless ($v=~/^[\d+\.]+$/) { $error.="\nNumber expected instead of $v"; } |
unless ($v=~/^[\d+\.]+$/) { push(@error,"Number expected instead of $v"); } |
} |
} |
unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) { |
unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) { |
$error.="\nInvalid Role"; |
push(@error,"Invalid Role"); |
} |
} |
|
|
if (!defined($primaryLibServer)) { |
if (!defined($primaryLibServer)) { |
if (@libservers > 0) { |
if (@libservers > 0) { |
$error .= "No primary library server ID designated. Choose from: ".join(',',sort(@libservers)); |
push(@error,"No primary library server ID designated. Choose from: ".join(',',sort(@libservers))); |
} else { |
} else { |
$error .= "No library servers in this domain (including current server)"; |
push(@error,"No library servers in this domain (including current server)"); |
} |
} |
} else { |
} else { |
if (length($primaryLibServer)>35) { $error.="\nPrimary Library Server ID: $primaryLibServer too long"; } |
if (length($primaryLibServer)>35) { push(@error,"Primary Library Server ID: $primaryLibServer too long"); } |
if (length($primaryLibServer)<2) { $error.="\nPrimary Library Server ID: $primaryLibServer too short"; } |
if (length($primaryLibServer)<2) { push(@error,"Primary Library Server ID: $primaryLibServer too short"); } |
if ($primaryLibServer =~/capa/i) { |
if ($primaryLibServer =~/capa/i) { |
if ($primaryLibServer!~/^oucapa\d+$/ && |
if ($primaryLibServer!~/^oucapa\d+$/ && |
($primaryLibServer!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) { |
($primaryLibServer!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) { |
$error.="\nPrimary library server ID $primaryLibServer contains 'capa'"; |
push(@error,"Primary library server ID $primaryLibServer contains 'capa'") |
} |
} |
} |
} |
foreach my $bad ('res','raw','userfiles','priv','adm','uploaded', |
foreach my $bad ('res','raw','userfiles','priv','adm','uploaded', |
'editupload') { |
'editupload') { |
$error.="\nPrimary library server ID $primaryLibServer reserved." if $primaryLibServer eq $bad; |
push(@error,"Primary library server ID $primaryLibServer reserved.") if $primaryLibServer eq $bad; |
} |
} |
if ($primaryLibServer=~/[^\w\-.]/) { $error.="\nPrimary library server ID $primaryLibServer contains special characters"; } |
if ($primaryLibServer=~/[^\w\-.]/) { push(@error,"Primary library server ID $primaryLibServer contains special characters"); } |
} |
} |
|
|
|
|
if ($error) { print "\n*** ERRORS: $error\n"; } |
if (@error) { print "\n*** ERRORS: \n\t".join("\n\t",@error)."\n"; } |
print(<<END); |
print(<<END); |
ENTER A CHOICE OF 1-11 TO CHANGE, otherwise ENTER 12: |
ENTER A CHOICE OF 1-11 TO CHANGE, otherwise ENTER 12: |
END |
END |
Line 928 unless (-l "<TARGET />") {
|
Line 912 unless (-l "<TARGET />") {
|
$line2insert=<<END; |
$line2insert=<<END; |
$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname |
$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname |
END |
END |
|
if (!$domainTabExtras) { |
|
$domainTabExtras=':::::'; |
|
} |
$domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras:$primaryLibServer\n"; |
$domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras:$primaryLibServer\n"; |
if ($lonCluster eq 'standalone') { |
if ($lonCluster eq 'standalone') { |
open(OUT,'>../'.$lonCluster.'_hosts.tab') or |
open(OUT,'>../'.$lonCluster.'_hosts.tab') or |