Annotation of doc/loncapafiles/updatequery.piml, revision 1.46

1.2       harris41    1: <!-- updatequery.piml -->
1.1       harris41    2: 
1.46    ! albertel    3: <!-- $Id: updatequery.piml,v 1.45 2006/01/07 14:29:16 www Exp $ -->
1.1       harris41    4: 
                      5: <!--
                      6: 
                      7: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      8: 
                      9: LON-CAPA is free software; you can redistribute it and/or modify
                     10: it under the terms of the GNU General Public License as published by
                     11: the Free Software Foundation; either version 2 of the License, or
                     12: (at your option) any later version.
                     13: 
                     14: LON-CAPA is distributed in the hope that it will be useful,
                     15: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     16: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     17: GNU General Public License for more details.
                     18: 
                     19: You should have received a copy of the GNU General Public License
                     20: along with LON-CAPA; if not, write to the Free Software
                     21: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     22: 
                     23: /home/httpd/html/adm/gpl.txt
                     24: 
                     25: http://www.lon-capa.org/
                     26: 
                     27: -->
                     28: 
                     29: <piml>
                     30: <targetroot>/</targetroot>
                     31: <files>
                     32: <file>
1.4       harris41   33: <target dist='default'>/</target>
1.1       harris41   34: <perlscript mode='fg'>
1.4       harris41   35: $|=1;
1.1       harris41   36:   print(&lt;&lt;END);
                     37: 
                     38: 
                     39: *********************************************
                     40: *********************************************
                     41: ****                                     ****
                     42: **** LON-CAPA SYSTEM INFORMATION REQUEST ****
                     43: ****                                     ****
                     44: **** Please respond to the choices below ****
                     45: ****                                     ****
                     46: *********************************************
                     47: *********************************************
                     48: 
                     49: END
1.4       harris41   50: sleep(3);
1.1       harris41   51: </perlscript>
                     52: </file>
                     53: <file>
1.22      albertel   54: <target dist='default'>loncom/hosts.tab</target>
                     55: <perlscript mode='fg'>
                     56: unless (-l "<TARGET />") {
                     57:   print(&lt;&lt;END);
                     58: 
                     59: ===============================================================================
1.30      www        60: Which cluster option would you like to have installed?
                     61: IMPORTANT: to take advantage of the cluster options 1) and 3),
                     62: you must contact lon-capa\@lon-capa.org.
                     63: 
                     64: 1) PRODUCTION - you want to eventually connect this machine to the
                     65:                 LON-CAPA content sharing network. This setting is for
                     66:                 schools, colleges, and universities, that currently
                     67:                 are running - or in the future will run - courses
1.22      albertel   68: 2) STAND-ALONE - you want this machine to run in 'stand-alone' mode and
                     69:                  not be connected to other LON-CAPA machines for now
1.30      www        70: 3) DEVELOPMENT - you want to do software (not content!) development with
                     71:                  this workstation and eventually link it with the
                     72:                  workstations of other LON-CAPA software developers.
1.40      albertel   73: 4) RUNNING YOUR OWN CLUSTER - this machine is not in the standard LON-CAPA
                     74:                  clusters and won't be in the future and you want the existing
                     75:                  hosts.tab and domain.tab files to be left alone.
                     76:                  (This choice is unlikely what you want to select.)
1.22      albertel   77: END
                     78: # Option number 26 will install rawhide_hosts.tab, but
                     79: # the typical user does not want to be part of an intensive
                     80: # machine test cluster.
                     81: 
                     82: # get input
                     83: # if valid then process, otherwise loop
                     84: $flag=0;
                     85: while (!$flag) {
                     86:   print "ENTER 1, 2, 3, or 4:\n";
                     87:   my $choice=&lt;&gt;;
                     88:   chomp($choice);
                     89:   if ($choice==1) {
                     90:     $lonCluster='production'; $flag=1;
                     91:   }
                     92:   elsif ($choice==2) {
                     93:     $lonCluster='standalone'; $flag=1;
                     94:   }
                     95:   elsif ($choice==3) {
                     96:     $lonCluster='development'; $flag=1;
                     97:   }
                     98:   elsif ($choice==4) {
                     99:     $lonCluster='existing'; $flag=1;
                    100:     if (-e '/home/httpd/lonTabs/hosts.tab') {
                    101:       `cp /home/httpd/lonTabs/hosts.tab ../existing_hosts.tab`;
                    102:     }
                    103:     else {
                    104:       print &lt;&lt;END;
                    105: There is no existing /home/httpd/lonTabs/hosts.tab
                    106: END
                    107:       die('');
                    108:     }
1.27      albertel  109:     if (-e '/home/httpd/lonTabs/domain.tab') {
                    110:       `cp /home/httpd/lonTabs/domain.tab ../existing_domain.tab`;
                    111:     }
                    112:     else {
                    113:       print &lt;&lt;END;
                    114: There is no existing /home/httpd/lonTabs/domain.tab
                    115: END
                    116:       die('');
                    117:     }
1.22      albertel  118:   }
                    119:   elsif ($choice==26) {
                    120:     $lonCluster='rawhide'; $flag=1;
                    121:   }
                    122: }
                    123: }
                    124: </perlscript>
                    125: </file>
                    126: <file>
1.10      harris41  127: <target dist='default'>/home/httpd/lonTabs/hosts.tab</target>
1.1       harris41  128: <perlscript mode='fg'>
1.4       harris41  129: $|=1;
1.20      albertel  130: my $domainDescription;
1.29      albertel  131: my $domainTabExtras;
1.43      raeburn   132: my $primaryLibServer;
                    133: my @libservers = ();
1.1       harris41  134: unless (-e "<TARGET />") {
                    135:   print(&lt;&lt;END);
                    136:            WELCOME TO LON-CAPA!
                    137: 
                    138: If you have questions, please visit http://install.lon-capa.org
1.32      raeburn   139: or contact helpdesk\@lon-capa.org.
1.1       harris41  140: 
                    141: ===============================================================================
1.4       harris41  142: The following 4 values are needed to configure LON-CAPA:
                    143: * Machine Role
1.8       harris41  144: * LON-CAPA Domain Name
                    145: * LON-CAPA Machine ID Name, and
1.1       harris41  146: * System Administration E-mail Address.
1.32      raeburn   147: ===============================================================================
                    148: 
                    149: In addition, a Support E-mail Address can also be included. If
                    150: an address is included then one of the options in the LON-CAPA 
                    151: help menu will be a link to a form that a user will complete to
                    152: request LON-CAPA help.  
                    153: 
1.1       harris41  154: END
1.3       harris41  155: 
1.4       harris41  156: open(OUT,'&gt;/tmp/loncapa_updatequery.out');
                    157: close(OUT);
                    158: 
1.3       harris41  159: # query for Machine Role
                    160:   print(&lt;&lt;END);
                    161: **** Machine Role ****
                    162: Library server (recommended if first-time installation of LON-CAPA):
                    163:    Servers that are repositories of authoritative educational resources.
                    164:    These servers also provide the construction space by which instructors
                    165:    assemble their classroom online material.
                    166: Access server:
                    167:    Servers that load-balance high-traffic delivery of educational resources
                    168:    over the world-wide web.
1.4       harris41  169: 1) Will this be a library server? (recommended if this is your first install)
1.3       harris41  170: 2) Or, will this be an access server?
                    171: END
1.4       harris41  172: my $flag=0;
                    173: my $r='';
                    174: my $lonRole;
                    175: while (!$flag) {
                    176:   print "ENTER A CHOICE OF 1 or 2:\n";
                    177:   my $choice=&lt;&gt;;
                    178:   chomp($choice);
                    179:   if ($choice==1) {
                    180:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
                    181:     print(OUT 'lonRole'."\t".'library'."\n");
                    182:     close(OUT);
                    183:     $lonRole='library';
                    184:     $r='l';
                    185:     $flag=1;
                    186:   }
                    187:   elsif ($choice==2) {
                    188:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
                    189:     print(OUT 'lonRole'."\t".'access'."\n");
                    190:     close(OUT);
                    191:     $lonRole='access';
                    192:     $r='a';
                    193:     $flag=2;
                    194:   }
                    195:   else {
                    196: 
                    197:   }
                    198: }
1.3       harris41  199: 
                    200: # need to recommend a machine ID name (ipdomain.l.somenumber)
1.36      albertel  201: my $hostname=`hostname -f`; chomp($hostname);
1.4       harris41  202: my $ipdomain='';
                    203: if ($hostname=~/([^\.]*)\.([^\.]*)$/) {
                    204:   $ipdomain=$1;
                    205: }
1.1       harris41  206: 
                    207:   print(&lt;&lt;END);
                    208: 
1.8       harris41  209: **** Domain ****
1.45      www       210: [This does NOT need to correspond to internet address domains.
                    211:  Please make this name short AND descriptive of your organization.
                    212:  Domain names are close to impossible to change later!!!
                    213:  Good examples might be "msu" or "bionet" or "vermontcc".
                    214:  Bad examples are "physics" (too general)
1.37      www       215:    or "michiganstateuniversity" (too long)
                    216:    or "msuedu" (internet domain, just make it "msu")
1.45      www       217:    or "msuphysics" (only if there is a good reason to limit to department
                    218:                     - we don't know of one)
1.37      www       219:    or "mydomain" (what is that?)
1.45      www       220:  Avoid multiple domains at the same institution, even if it means that you 
                    221:  have to actually work together with your colleagues. You can still run
                    222:  multiple library servers within the same domain.
                    223:  If this domain is eventually going to be part of the main production
                    224:  cluster, you MUST contact the LON-CAPA group at MSU (loncapa@loncapa.org)
                    225:  to have a domain name assigned, and then use it exactly as given. This is
                    226:  also true for test installs that might eventually turn into production setups.
                    227:  Stop now if you didn't do so.]
1.1       harris41  228: END
1.8       harris41  229: 
                    230: # get domain name
1.1       harris41  231: # accept if valid, if not valid, tell user and repeat
1.4       harris41  232: $flag=0;
1.8       harris41  233: my $lonDefDomain;
1.4       harris41  234: while (!$flag) {
                    235: if ($ipdomain) {
                    236: print(&lt;&lt;END);
1.8       harris41  237: ENTER LONCAPA DOMAIN [$ipdomain]:
1.4       harris41  238: END
                    239: }
                    240: else {
                    241:   print(&lt;&lt;END);
1.8       harris41  242: ENTER LONCAPA DOMAIN:
1.4       harris41  243: END
                    244: }
                    245:   my $choice=&lt;&gt;;
                    246:   chomp($choice);
1.18      harris41  247:   my $bad_domain_flag=0;
1.41      albertel  248:   my @bad_domain_names=('res','raw','userfiles','priv','adm','uploaded',
                    249: 	'editupload');
1.18      harris41  250:   foreach my $bad (@bad_domain_names) {
                    251:     $bad_domain_flag=1 if $choice eq $bad;
                    252:   }
1.37      www       253:   if ($choice=~/capa/i) {
                    254:      $bad_domain_flag=1;
                    255:   }
1.8       harris41  256:   if ($ipdomain and $choice=~/^\s*$/) {
                    257:     $choice=$ipdomain;
1.4       harris41  258:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
1.8       harris41  259:     print(OUT 'lonDefDomain'."\t".$choice."\n");
1.4       harris41  260:     close(OUT);
1.8       harris41  261:     $lonDefDomain=$choice;
1.4       harris41  262:     $flag=1;
1.37      www       263:   } elsif (length($choice)>12) {
                    264:     print "Name too long\n";
                    265:   } elsif (length($choice)<2) {
                    266:     print "Name too short\n";
1.38      www       267:   } elsif ($bad_domain_flag) {
                    268:     print "Invalid input ('$choice' conflicts with LON-CAPA namespace).\n";
                    269:     print "Please try something different than '$choice'\n";
1.37      www       270:   } elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
1.4       harris41  271:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
1.8       harris41  272:     print(OUT 'lonDefDomain'."\t".$choice."\n");
1.4       harris41  273:     close(OUT);
1.8       harris41  274:     $lonDefDomain=$choice;
                    275:     $r='l';
1.4       harris41  276:     $flag=1;
1.37      www       277:   } else {
1.4       harris41  278:     print "Invalid input (only alphanumeric characters supported).\n";
                    279:   }
                    280: }
1.1       harris41  281: 
1.20      albertel  282: 
                    283: # get domain description
                    284: # accept if valid, if not valid, tell user and repeat
                    285: $flag=0;
                    286: 
                    287: while (!$flag) {
                    288:   print(&lt;&lt;END);
                    289: 
                    290: **** Domain Description ****
                    291: String describing the domain, to be shown to users.
                    292: [Example, msu is Michigan State University]
                    293: ENTER DOMAIN DESCRIPTION:
                    294: END
                    295: 
                    296:   my $choice=&lt;&gt;;
                    297:   chomp($choice);
                    298:   if ($choice!~/:/) {
                    299:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
                    300:     print(OUT 'domainDescription'."\t".$choice."\n");
                    301:     close(OUT);
                    302:     $domainDescription=$choice;
                    303:     $flag=1;
                    304:   }
                    305:   else {
                    306:     print "Invalid input (no ':' allowed).\n";
                    307:   }
                    308: }
                    309: 
1.8       harris41  310: my $lonHostID;
                    311: if ($lonDefDomain) {
                    312:   $lonHostID=$lonDefDomain.$r.int(1+rand(9)); # should be probably also detect
                    313:                                               # against the hosts.tab
                    314: }
                    315: 
1.1       harris41  316:   print(&lt;&lt;END);
                    317: 
1.8       harris41  318: **** Machine ID Name ****
1.45      www       319: [This does NOT need to correspond to internet address names;
1.8       harris41  320:  this name MUST be unique to the whole LON-CAPA network;
1.45      www       321:  we recommend that you use a name based off of your institution.
                    322:  Good examples: "msul1" or "bioneta2".
                    323:  Bad examples: "loncapabox" or "studentsinside".
1.37      www       324:  Note that machine names are very hard to change later.]
1.1       harris41  325: END
1.8       harris41  326: # get machine name
1.1       harris41  327: # accept if valid, if not valid, tell user and repeat
1.4       harris41  328: $flag=0;
                    329: while (!$flag) {
                    330: if ($ipdomain) {
                    331: print(&lt;&lt;END);
1.8       harris41  332: ENTER LONCAPA MACHINE ID [$lonHostID]:
1.4       harris41  333: END
                    334: }
                    335: else {
                    336:   print(&lt;&lt;END);
1.8       harris41  337: ENTER LONCAPA MACHINE ID:
1.4       harris41  338: END
                    339: }
                    340:   my $choice=&lt;&gt;;
                    341:   chomp($choice);
1.37      www       342:   if ($choice=~/capa/i) {
                    343:     print "Invalid input (names containing 'capa' are reserved).\n";
                    344:   } elsif ($lonHostID and $choice=~/^\s*$/) {
1.8       harris41  345:     $choice=$lonHostID;
1.4       harris41  346:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
1.8       harris41  347:     print(OUT 'lonHostID'."\t".$choice."\n");
1.4       harris41  348:     close(OUT);
1.8       harris41  349:     $lonHostID=$choice;
1.4       harris41  350:     $flag=1;
1.37      www       351:   } elsif (length($choice)>15) {
                    352:     print "Name too long\n";
                    353:   } elsif (length($choice)<4) {
                    354:     print "Name too short\n";
                    355:   } elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
1.4       harris41  356:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
1.8       harris41  357:     print(OUT 'lonHostID'."\t".$choice."\n");
1.4       harris41  358:     close(OUT);
1.8       harris41  359:     $lonHostID=$choice;
1.4       harris41  360:     $flag=1;
1.37      www       361:   } else {
1.4       harris41  362:     print "Invalid input (only alphanumeric characters supported).\n";
                    363:   }
                    364: }
1.1       harris41  365: 
1.43      raeburn   366: # get primary library server in domain
                    367: if ($lonRole eq 'library') {
                    368:     if (!grep/^\Q$lonHostID\E$/,@libservers) {
                    369:         push(@libservers,$lonHostID);
                    370:     } 
                    371:     if (@libservers == 1) {
                    372:         $primaryLibServer = $libservers[0];
                    373:     }
                    374: }
                    375: while (!$flag) {
                    376:   print(&lt;&lt;END);
                    377: **** Domain's Primary Library Server ID ****
                    378: This should be the LON-CAPA machine ID of a library server in your 
                    379: domain.  If you only have a single library server in your domain, then
                    380: the Primary Library server ID will be the machine ID of that server. 
                    381: This server will be where domain data which are not associated with any
                    382: specific home library server will be stored (e.g., e-mail broadcast by
                    383: administrators to users in the domain).
                    384: END
                    385:     if (defined($primaryLibServer)) {
                    386:         print(&lt;&lt;END);
                    387: ENTER DOMAIN'S PRIMARY LIBRARY SERVER ID [$primaryLibServer]:
                    388: END
                    389:     } elsif (@libservers > 0) {
                    390:         print(&lt;&lt;END);
                    391: ENTER DOMAIN'S PRIMARY LIBRARY SERVER ID [$libservers[0]]
                    392: END
                    393:     } else {
                    394:         print (&lt;&lt;END);
                    395: No library servers could be identified for this domain.  If you have already installed LON-CAPA on a different server (designated as a library server) in this domain, please enter the LONCAPA MACHINE ID of that server.  If not, you will need to install a LON-CAPA library server.  Enter the MACHINE ID of the server you plan to designate as a library server.
                    396: END
                    397:     }
                    398: 
                    399:     my $choice=&lt;&gt;;
                    400:     chomp($choice);
                    401:     if ($primaryLibServer and $choice=~/^\s*$/) {
                    402:         $choice=$primaryLibServer;
                    403:         open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
                    404:         print(OUT 'primaryLibServer'."\t".$choice."\n");
                    405:         close(OUT);
                    406:         $flag=1;
                    407:     } elsif (length($choice)>15) {
                    408:         print "Name too long\n";
                    409:     } elsif (length($choice)<4) {
                    410:         print "Name too short\n";
                    411:     } elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
                    412:         open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
                    413:         print(OUT 'primaryLibServer'."\t".$choice."\n");
                    414:         close(OUT);
                    415:         $primaryLibServer=$choice;
                    416:         $flag=1;
                    417:     } else {
                    418:         print "Invalid input (only alphanumeric characters supported).\n";
                    419:     }
                    420: }
                    421: 
                    422: 
1.32      raeburn   423: # get admin e-mail address
1.4       harris41  424: # accept if valid, if not valid, tell user and repeat
                    425: $flag=0;
1.9       harris41  426: my $lonAdmEMail;
1.4       harris41  427: while (!$flag) {
1.1       harris41  428:   print(&lt;&lt;END);
                    429: 
                    430: **** System Administrator's E-mail ****
                    431: E-mail address of the person who will manage this machine
1.4       harris41  432: [should be in the form somebody\@somewhere]
1.32      raeburn   433: ENTER ADMIN E-MAIL ADDRESS:
1.1       harris41  434: END
                    435: 
1.4       harris41  436:   my $choice=&lt;&gt;;
                    437:   chomp($choice);
                    438:   if ($choice=~/\@/) {
                    439:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
1.9       harris41  440:     print(OUT 'lonAdmEMail'."\t".$choice."\n");
1.4       harris41  441:     close(OUT);
1.9       harris41  442:     $lonAdmEMail=$choice;
1.4       harris41  443:     $flag=1;
                    444:   }
                    445:   else {
                    446:     print "Invalid input (this needs to look like an e-mail address!).\n";
                    447:   }
                    448: }
                    449: 
1.32      raeburn   450: 
                    451: # get support e-mail address
                    452: # accept if valid, if not valid, tell user and repeat
                    453: $flag=0;
                    454: my $lonSupportEMail;
                    455: while (!$flag) {
                    456:   print(&lt;&lt;END);
                    457: 
                    458: **** Support E-mail ****
                    459: E-mail address of the person who will receive 
                    460: help requests from LON-CAPA users who access 
                    461: the system via this server. If the address is left blank,
                    462: then a help support form will not be displayed 
                    463: as part of the help menu.
                    464: [should be in the form somebody\@somewhere]
                    465: ENTER SUPPORT E-MAIL ADDRESS:
                    466: END
                    467: 
                    468:   my $choice=&lt;&gt;;
                    469:   chomp($choice);
                    470:   $choice =~ s/\s//g;
1.33      albertel  471:   if ( ($choice=~/\@/) || $choice eq '') {
1.32      raeburn   472:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
                    473:     print(OUT 'lonSupportEMail'."\t".$choice."\n");
                    474:     close(OUT);
                    475:     $lonSupportEMail=$choice;
                    476:     $flag=1;
                    477:   }
                    478:   else {
                    479:     print "Invalid input (this either needs to be blank, or look like an e-mail address!).\n";
                    480:   }
                    481: }
                    482: 
                    483: 
1.1       harris41  484: # update loncapa.conf
1.7       harris41  485: my $confdir='/etc/httpd/conf/';
                    486: #my $confdir='';
1.5       harris41  487: my $filename='loncapa.conf';
                    488: my %perlvar;
                    489:     if (-e "$confdir$filename") {
                    490: 	open(CONFIG,'&lt;'.$confdir.$filename) or die("Can't read $confdir$filename");
                    491: 	while (my $configline=&lt;CONFIG&gt;) {
                    492: 	    if ($configline =~ /^[^\#]*PerlSetVar/) {
                    493: 		my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
                    494: 		chomp($varvalue);
1.12      harris41  495: 		$perlvar{$varname}=$varvalue if $varvalue!~/^\{\[\[\[\[/;
1.5       harris41  496: 	    }
                    497: 	}
                    498: 	close(CONFIG);
                    499:     }
                    500:     $perlvar{'lonHostID'}=$lonHostID;
                    501:     $perlvar{'lonDefDomain'}=$lonDefDomain;
1.9       harris41  502:     $perlvar{'lonAdmEMail'}=$lonAdmEMail;
1.32      raeburn   503:     $perlvar{'lonSupportEMail'}=$lonSupportEMail;
1.5       harris41  504:     $perlvar{'lonRole'}=$lonRole;
1.16      harris41  505:     unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) {
1.5       harris41  506:        $perlvar{'lonLoadLim'}='2.00';
                    507:     }
1.25      albertel  508:     unless ($perlvar{'lonUserLoadLim'} and $perlvar{'lonUserLoadLim'}!~/\{\[\[\[\[/) {
                    509:        $perlvar{'lonUserLoadLim'}='0';
                    510:     }
1.16      harris41  511:     unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) {
1.5       harris41  512:        $perlvar{'lonExpire'}='86400';
                    513:     }
1.16      harris41  514:     unless ($perlvar{'lonReceipt'} and $perlvar{'lonReceipt'}!~/\{\[\[\[\[/) {
1.5       harris41  515:        my $lonReceipt='';
1.11      harris41  516:        srand(time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
1.5       harris41  517:        my @alnum=(0..9,a..z);
                    518:        foreach my $i (1..20) {
                    519: 	 $lonReceipt.=$alnum[int(rand(36))];
                    520:        }
                    521:        $perlvar{'lonReceipt'}=$lonReceipt;
                    522:     }
                    523:     open(OUT,"&gt;$confdir$filename") or
                    524:       die("Cannot output to $confdir$filename\n");
                    525:     foreach my $key (keys %perlvar) {
                    526:       my $value=$perlvar{$key};
                    527:       print(OUT &lt;&lt;END);
                    528: PerlSetVar     $key      $value
                    529: END
                    530:     }
                    531:     close(OUT);
1.1       harris41  532: }
                    533: </perlscript>
                    534: </file>
                    535: <file>
1.5       harris41  536: <target dist='default'>/</target>
1.1       harris41  537: <perlscript mode='fg'>
1.31      albertel  538: sub securesetting {
                    539:     my (%perlvar)=@_;
                    540:     my $securestatus='unknown';
                    541:     my $securenum='';
                    542:     if      ( $perlvar{'loncAllowInsecure'}&&  $perlvar{'londAllowInsecure'}) {
                    543: 	$securestatus='no';                  $securenum='4';
                    544:     } elsif ( $perlvar{'loncAllowInsecure'}&& !$perlvar{'londAllowInsecure'}) {
                    545: 	$securestatus='lond';                $securenum='3';
                    546:     } elsif (!$perlvar{'loncAllowInsecure'}&&  $perlvar{'londAllowInsecure'}) {
                    547: 	$securestatus='lonc';                $securenum='2';
                    548:     } elsif (!$perlvar{'loncAllowInsecure'}&& !$perlvar{'londAllowInsecure'}) {
                    549: 	$securestatus='yes (lond and lonc)'; $securenum='1';
                    550:     }
                    551:     return ($securestatus,$securenum);
                    552: }
1.1       harris41  553: # read values from loncapa.conf
1.7       harris41  554: my $confdir='/etc/httpd/conf/';
1.5       harris41  555: my $filename='loncapa.conf';
                    556: my %perlvar;
1.31      albertel  557: my ($securestatus,$securenum);
1.5       harris41  558:     if (-e "$confdir$filename") {
                    559: 	open(CONFIG,'&lt;'.$confdir.$filename) or 
                    560:           die("Can't read $confdir$filename");
                    561: 	while (my $configline=&lt;CONFIG&gt;) {
                    562: 	    if ($configline =~ /^[^\#]*PerlSetVar/) {
                    563: 		my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
                    564: 		chomp($varvalue);
                    565: 		$perlvar{$varname}=$varvalue;
                    566: 	    }
                    567: 	}
                    568: 	close(CONFIG);
                    569:     }
1.16      harris41  570:     unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) {
                    571:        $perlvar{'lonLoadLim'}='2.00';
                    572:     }
1.25      albertel  573:     unless ($perlvar{'lonUserLoadLim'} and $perlvar{'lonUserLoadLim'}!~/\{\[\[\[\[/) {
                    574:        $perlvar{'lonUserLoadLim'}='0';
                    575:     }
1.16      harris41  576:     unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) {
                    577:        $perlvar{'lonExpire'}='86400';
                    578:     }
1.31      albertel  579:     unless ($perlvar{'londAllowInsecure'} and $perlvar{'londAllowInsecure'}!~/\{\[\[\[\[/) {
                    580:        $perlvar{'londAllowInsecure'}='1';
                    581:     }
                    582:     unless ($perlvar{'loncAllowInsecure'} and $perlvar{'loncAllowInsecure'}!~/\{\[\[\[\[/) {
                    583:        $perlvar{'loncAllowInsecure'}='1';
                    584:     }
                    585:     ($securestatus,$securenum)=&securesetting(%perlvar);
1.16      harris41  586:     unless ($perlvar{'lonReceipt'} and $perlvar{'lonReceipt'}!~/\{\[\[\[\[/) {
                    587:        my $lonReceipt='';
                    588:        srand(time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
                    589:        my @alnum=(0..9,a..z);
                    590:        foreach my $i (1..20) {
                    591: 	 $lonReceipt.=$alnum[int(rand(36))];
                    592:        }
                    593:        $perlvar{'lonReceipt'}=$lonReceipt;
                    594:     }
1.7       harris41  595: my %perlvarstatic;
                    596:     if (-e "${confdir}loncapa_apache.conf") {
                    597: 	open(CONFIG,'&lt;'.$confdir.'loncapa_apache.conf') or 
                    598:           die("Can't read ${confdir}loncapa_apache.conf");
                    599: 	while (my $configline=&lt;CONFIG&gt;) {
                    600: 	    if ($configline =~ /^[^\#]*PerlSetVar/) {
                    601: 		my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
                    602: 		chomp($varvalue);
                    603: 		$perlvarstatic{$varname}=$varvalue;
                    604: 	    }
                    605: 	}
                    606: 	close(CONFIG);
                    607:     }
1.23      albertel  608:     if (!$domainDescription && $lonCluster ne 'existing') {
1.27      albertel  609:        open(IN,'&lt;../'.$lonCluster.'_domain.tab');
1.22      albertel  610:        while(&lt;IN&gt;) {
1.27      albertel  611:           if (/^$perlvar{'lonDefDomain'}\:/) {
1.29      albertel  612: 	     (undef,$domainDescription,$domainTabExtras)=split(/:/,$_,3);
1.22      albertel  613: 	     chomp($domainDescription);
1.29      albertel  614: 	     chomp($domainTabExtras);
1.46    ! albertel  615: 	     # the remianing field (primary lib server) is handled later
        !           616: 	     $domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0..5]);
1.22      albertel  617:              last;
                    618:           }
                    619:        }
1.23      albertel  620:        close(IN);
1.22      albertel  621:     }
1.23      albertel  622:     if (!$domainDescription) {
1.27      albertel  623:        open(IN,'&lt;/home/httpd/lonTabs/domain.tab');
1.23      albertel  624:        while(&lt;IN&gt;) {
1.27      albertel  625:           if (/^$perlvar{'lonDefDomain'}\:/) {
1.29      albertel  626: 	     (undef,$domainDescription,$domainTabExtras)=split(/:/,$_,3);
1.23      albertel  627: 	     chomp($domainDescription);
1.29      albertel  628: 	     chomp($domainTabExtras);
1.46    ! albertel  629: 	     # the remianing field (primary lib server) is handled later
        !           630: 	     $domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0-5]);
1.23      albertel  631:              last;
                    632:           }
                    633:        }
                    634:        close(IN);
                    635:     }
1.43      raeburn   636:     if (!$primaryLibServer and $lonCluster ne 'existing') {
                    637:         open(IN,'&lt;../'.$lonCluster.'_domain.tab');
                    638:         while(&lt;IN&gt;) {
                    639:             if (/^$perlvar{'lonDefDomain'}\:/) {
                    640:                 (undef,undef,undef,undef,undef,undef,undef,undef,
                    641:                                               $primaryLibServer)=split(/:/,$_);
                    642:                 chomp($primaryLibServer);
                    643:             }
                    644:         }
                    645:         close(IN);
                    646:         if (!$primaryLibServer) {
                    647:             open(IN,'&lt;../'.$lonCluster.'_hosts.tab');
                    648:             while(&lt;IN&gt;) {
                    649:                 if (/^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) {
                    650:                     push(@libservers,$1);
                    651:                 }
                    652:             }
                    653:             close(IN);
                    654:             if (@libservers == 1) {
                    655:                 $primaryLibServer = $libservers[0];
                    656:             }
                    657:         }
                    658:     }
                    659:     if (!$primaryLibServer) {
                    660:         open(IN,'&lt;/home/httpd/lonTabs/domain.tab');
                    661:         while(&lt;IN&gt;) {
                    662:             if (/^$perlvar{'lonDefDomain'}\:/) {
                    663:                 (undef,undef,undef,undef,undef,undef,undef,undef,
                    664:                                               $primaryLibServer)=split(/:/,$_);
                    665:                 chomp($primaryLibServer);
                    666:             }
                    667:             close(IN);
                    668:         }
                    669:         if (!$primaryLibServer) {
                    670:             open(IN,'&lt;/home/httpd/lonTabs/hosts.tab');
                    671:             while(&lt;IN&gt;) {
                    672:                 if (/^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) {
                    673:                     push(@libservers,$1);
                    674:                 }
                    675:             }
                    676:             close(IN);
                    677:             if (@libservers == 1) {
                    678:                 $primaryLibServer = $libservers[0];
                    679:             }
                    680:         }
                    681:     }
1.23      albertel  682:    
1.6       harris41  683: # implement editing logic below, interactively
1.46    ! albertel  684: # update loncapa.conf until 12 is entered
1.6       harris41  685: 
                    686: $flag=0;
1.17      harris41  687: 
1.6       harris41  688: while (!$flag) {
1.1       harris41  689:   print(&lt;&lt;END);
                    690: 
                    691: ===============================================================================
                    692: This is now the current configuration of your machine.
1.31      albertel  693:  1) Domain Name: $perlvar{'lonDefDomain'}
                    694:  2) Domain Description: $domainDescription
                    695:  3) Machine Name: $perlvar{'lonHostID'}
1.43      raeburn   696:  4) ID of primary library server for domain: $primaryLibServer
                    697:  5) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
                    698:  6) Support E-mail Address: $perlvar{'lonSupportEMail'}
                    699:  7) Role: $perlvar{'lonRole'}
                    700:  8) Cache Expiration Time: $perlvar{'lonExpire'}
                    701:  9) Server Load: $perlvar{'lonLoadLim'}
                    702: 10) User Load: $perlvar{'lonUserLoadLim'}
                    703: 11) Allow only secure connections: $securestatus 
                    704: 12) Everything is correct up above
1.6       harris41  705: END
1.38      www       706: 
                    707: my $error='';
                    708: foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) {
                    709:    if (length($v)>16) { $error.="\nName $v too long"; }		
                    710:    if (length($v)<2) { $error.="\nName $v too short"; }
1.39      albertel  711:    if ($v=~/capa/i) {
                    712: 	if ($v!~/^oucapa\d+$/ && 
                    713: 	    ($v!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) {
                    714: 		 $error.="\nName $v contains 'capa'"; 
                    715: 	}
                    716:    }
1.41      albertel  717:    foreach my $bad ('res','raw','userfiles','priv','adm','uploaded',
                    718: 	'editupload') {
1.38      www       719:       $error.="\nName $v reserved." if $v eq $bad;
                    720:    }
                    721:    if ($v=~/\W/) { $error.="\nName $v contains special characters"; }
                    722: }
1.42      albertel  723: if ($domainDescription!~/^[\(\)\-\w\s,]+$/) {
1.38      www       724:    $error.="\nDomain Description contains special characters";
                    725: } 
                    726: foreach my $v ($perlvar{'lonExpire'},$perlvar{'lonLoadLim'}) {
                    727:    unless ($v=~/^[\d+\.]+$/) { $error.="\nNumber expected instead of $v"; }
                    728: }
                    729: unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) {
                    730:    $error.="\nInvalid Role";
1.17      harris41  731: }
1.43      raeburn   732: 
                    733: if (!defined($primaryLibServer)) {
                    734:    if (@libservers > 0) {
                    735:        $error .= "No primary library server ID designated. Choose from: ".join(',',sort(@libservers));
                    736:    } else {
                    737:        $error .= "No library servers in this domain (including current server)";
                    738:    }
                    739: } else {
                    740:    if (length($primaryLibServer)>16) { $error.="\nPrimary Library Server ID:  $primaryLibServer too long"; }
                    741:    if (length($primaryLibServer)<2) { $error.="\nPrimary Library Server ID:  $primaryLibServer too short"; }
                    742:    if ($primaryLibServer =~/capa/i) {
                    743:         if ($primaryLibServer!~/^oucapa\d+$/ &&
                    744:             ($primaryLibServer!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) {
                    745:                  $error.="\nPrimary library server ID $primaryLibServer contains 'capa'";
                    746:         }
                    747:    }
                    748:    foreach my $bad ('res','raw','userfiles','priv','adm','uploaded',
                    749:         'editupload') {
                    750:       $error.="\nPrimary library server ID $primaryLibServer reserved." if $primaryLibServer eq $bad;
                    751:    }
                    752:    if ($primaryLibServer=~/\W/) { $error.="\nPrimary library server ID $primaryLibServer contains special characters"; }
                    753: }
                    754: 
                    755: 
1.38      www       756: if ($error) { print "\n*** ERRORS: $error\n"; }
1.6       harris41  757:   print(&lt;&lt;END);
1.43      raeburn   758: ENTER A CHOICE OF 1-11 TO CHANGE, otherwise ENTER 12:
1.1       harris41  759: END
1.5       harris41  760: my $choice=&lt;&gt;;
                    761: chomp($choice);
1.6       harris41  762:   if ($choice==1) {
                    763:   print(&lt;&lt;END);
1.16      harris41  764: 1) Domain Name: $perlvar{'lonDefDomain'}
1.20      albertel  765: ENTER NEW VALUE (this is an internal value used to identify a group of
                    766:                  LON-CAPA machines, it must be alphanumerical, we suggest
                    767:                  using a part of your actual DNS domain. For example, for
                    768:                  the machine loncapa.msu.edu, we set the Domain to msu):
1.6       harris41  769: END
                    770:     my $choice2=&lt;&gt;;
                    771:     chomp($choice2);
1.8       harris41  772:     $perlvar{'lonDefDomain'}=$choice2;
1.6       harris41  773:   }
                    774:   elsif ($choice==2) {
                    775:   print(&lt;&lt;END);
1.20      albertel  776: 2) Domain Description: $domainDescription
                    777: ENTER NEW VALUE (this should be a string that describes your domain, spaces
                    778:                  and punctuation are fine except for ':'):
                    779: END
                    780:     my $choice2=&lt;&gt;;
                    781:     chomp($choice2);
                    782:     $domainDescription=$choice2;
                    783:   }
                    784:   elsif ($choice==3) {
                    785:   print(&lt;&lt;END);
                    786: 3) Machine Name: $perlvar{'lonHostID'}
                    787: ENTER NEW VALUE (this will be the name of the machine in the LON-CAPA network
                    788:                  it cannot contain any of '_' '-' '.' or ':'. We suggest that
                    789:                  if you are in the domain 'example' and are the first library
                    790:                  server you enter 'examplel1') :
1.6       harris41  791: END
                    792:     my $choice2=&lt;&gt;;
                    793:     chomp($choice2);
1.8       harris41  794:     $perlvar{'lonHostID'}=$choice2;
1.6       harris41  795:   }
1.20      albertel  796:   elsif ($choice==4) {
1.6       harris41  797:   print(&lt;&lt;END);
1.43      raeburn   798: 4) ID of primary library server for domain: $primaryLibServer
                    799: ENTER NEW VALUE (this will be the LON-CAPA Machine ID of a library server in
                    800:                  your domain; it cannot contain any of '_' '-' '.' or ':'. 
                    801:                  This server will be where domain data which are not 
                    802:                  associated with any specific home library server
                    803:                  will be stored (e.g., e-mail broadcast by Domain Coordinators
                    804:                  to users in the domain).
                    805: END
                    806:     my $choice2=&lt;&gt;;
                    807:     chomp($choice2);
                    808:     $primaryLibServer=$choice2;
                    809:   }
                    810:   elsif ($choice==5) {
                    811:   print(&lt;&lt;END);
                    812: 5) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
1.6       harris41  813: ENTER NEW VALUE:
                    814: END
                    815:     my $choice2=&lt;&gt;;
                    816:     chomp($choice2);
1.9       harris41  817:     $perlvar{'lonAdmEMail'}=$choice2;
1.6       harris41  818:   }
1.43      raeburn   819:   elsif ($choice==6) {
1.6       harris41  820:   print(&lt;&lt;END);
1.43      raeburn   821: 6) Support E-mail Address: $perlvar{'lonSupportEMail'}
1.32      raeburn   822: ENTER NEW VALUE:
                    823: END
                    824:     my $choice2=&lt;&gt;;
                    825:     chomp($choice2);
                    826:     $perlvar{'lonSupportEMail'}=$choice2;
                    827:   }
1.43      raeburn   828:   elsif ($choice==7) {
1.32      raeburn   829:   print(&lt;&lt;END);
1.43      raeburn   830: 7) Role: $perlvar{'lonRole'}
1.20      albertel  831: ENTER NEW VALUE (this should be either 'access' or 'library' 
                    832:                  if in doubt select 'library'):
1.6       harris41  833: END
                    834:     my $choice2=&lt;&gt;;
                    835:     chomp($choice2);
                    836:     $perlvar{'lonRole'}=$choice2;
                    837:   }
1.43      raeburn   838:   elsif ($choice==8) {
1.6       harris41  839:   print(&lt;&lt;END);
1.43      raeburn   840: 8) Cache Expiration Time: $perlvar{'lonExpire'}
1.20      albertel  841: ENTER NEW VALUE (in seconds, 86400 is a reasonable value):
1.6       harris41  842: END
                    843:     my $choice2=&lt;&gt;;
                    844:     chomp($choice2);
                    845:     $perlvar{'lonExpire'}=$choice2;
                    846:   }
1.43      raeburn   847:   elsif ($choice==9) {
1.6       harris41  848:   print(&lt;&lt;END);
1.43      raeburn   849: 9) Server Load: $perlvar{'lonLoadLim'}
1.6       harris41  850: ENTER NEW VALUE:
                    851: END
                    852:     my $choice2=&lt;&gt;;
                    853:     chomp($choice2);
                    854:     $perlvar{'lonLoadLim'}=$choice2;
                    855:   }
1.43      raeburn   856:   elsif ($choice==10) {
1.25      albertel  857:   print(&lt;&lt;END);
1.43      raeburn   858: 10) User Load: $perlvar{'lonUserLoadLim'}
1.25      albertel  859: Numer of users that can login before machine is 'overloaded'
1.26      albertel  860: ENTER NEW VALUE (integer value, 0 means there is no limit):
1.25      albertel  861: END
                    862:     my $choice2=&lt;&gt;;
                    863:     chomp($choice2);
                    864:     $perlvar{'lonUserLoadLim'}=$choice2;
                    865:   }
1.43      raeburn   866:   elsif ($choice==11) {
1.31      albertel  867:   print(&lt;&lt;END);
1.43      raeburn   868: 11) Allow only secure connections: $securestatus 
1.31      albertel  869: The Lon-CAPA communication daemons lonc and lond can be configured to
                    870: allow only secure connections by default.
                    871: 
                    872: POSSIBLE CHOICES:
                    873: 1) allow only secure connections and don't connect to machines that
                    874:     can not be connected to securely
                    875: 2) allow only secure connections but allow this machine to connect to 
                    876:     machines that don't support secure connections
                    877: 3) allow insecure connections to this machine but only allow connections
                    878:     to machines that support secure connections
                    879: 4) allow insecure connections
                    880: ENTER NEW VALUE (currenly $securenum):
                    881: END
                    882:     my $choice2=&lt;&gt;;
                    883:     chomp($choice2);
                    884:     if      ($choice2 eq '1') {
                    885: 	$perlvar{'loncAllowInsecure'}=0;$perlvar{'londAllowInsecure'}=0;
                    886:     } elsif ($choice2 eq '2') {
                    887: 	$perlvar{'loncAllowInsecure'}=0;$perlvar{'londAllowInsecure'}=1;
                    888:     } elsif ($choice2 eq '3') {
                    889: 	$perlvar{'loncAllowInsecure'}=1;$perlvar{'londAllowInsecure'}=0;
                    890:     } elsif ($choice2 eq '4') {
                    891: 	$perlvar{'loncAllowInsecure'}=1;$perlvar{'londAllowInsecure'}=1;
                    892:     }
                    893:     ($securestatus,$securenum)=&securesetting(%perlvar);
                    894:   }
1.43      raeburn   895:   elsif (($choice==12) && (!$error)) {
1.6       harris41  896:     $flag=1;
                    897:   }
                    898:   else {
1.38      www       899:     print "Invalid input.\n";
1.6       harris41  900:   }
                    901: }
1.7       harris41  902:     open(OUT,"&gt;$confdir$filename") or
                    903:       die("Cannot output to $confdir$filename\n");
                    904:     foreach my $key (keys %perlvar) {
                    905:       my $value=$perlvar{$key};
1.8       harris41  906:       print(OUT &lt;&lt;END) unless $perlvarstatic{$key};
1.7       harris41  907: PerlSetVar     $key      $value
                    908: END
                    909:     }
                    910:     close(OUT);
1.1       harris41  911: </perlscript>
                    912: </file>
                    913: <file>
                    914: <target dist='default'>loncom/hosts.tab</target>
                    915: <perlscript mode='fg'>
                    916: unless (-l "<TARGET />") {
1.36      albertel  917:   my $hostname=`hostname -f`;chomp($hostname);
1.15      harris41  918:   $date=`date -I`; chomp($date);
                    919:   $lonHostID=$perlvar{'lonHostID'};
                    920:   $lonHostID=~s/\W//g;
                    921:   $lineexistflag=0;
                    922:   $hostidexistflag=0;
1.22      albertel  923:   $line2insert=&lt;&lt;END;
1.35      albertel  924: $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname
1.15      harris41  925: END
1.43      raeburn   926:   $domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras:$primaryLibServer\n";
1.23      albertel  927:   if ($lonCluster eq 'standalone') {
                    928:     open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or
                    929:       die('file generation error');
                    930:       print(OUT $line2insert);
                    931:     close(OUT);
1.27      albertel  932:     open(OUT,'&gt;../'.$lonCluster.'_domain.tab') or
                    933:       die('file generation error');
                    934:       print(OUT $domaininsert);
                    935:     close(OUT);
1.23      albertel  936:   }
1.15      harris41  937:   if ($flag==1) {
1.6       harris41  938:     `rm -f ../hosts.tab`;
1.15      harris41  939:     open(IN,'&lt;../'.$lonCluster.'_hosts.tab');
1.13      harris41  940:     while(&lt;IN&gt;) {
                    941:       if (/^$line2insert$/) {
                    942:         $lineexistflag=1;
                    943:       }
1.15      harris41  944:       if (/^$lonHostID\:/) {
1.13      harris41  945:         $hostidexistflag=1;
                    946:       }
                    947:     }
                    948:     close(IN);
                    949:     if ($hostidexistflag and !$lineexistflag) {
                    950:       print &lt;&lt;END;
                    951: WARNING: $lonHostID already exists inside
1.15      harris41  952: loncapa/loncom/${lonCluster}_hosts.tab.  The entry inside
                    953: ${lonCluster}_hosts.tab does not match your settings.
                    954: The entry inside ${lonCluster}_hosts.tab is being replaced
1.13      harris41  955: with your new values.
                    956: END
1.15      harris41  957:       `grep -v "$lonHostID:" ../${lonCluster}_hosts.tab &gt; ../new_${lonCluster}_hosts.tab`;
                    958:        open(OUT,'&gt;&gt;../new_'.$lonCluster.'_hosts.tab') or
                    959:          die("cannot open loncom/${lonCluster}_hosts.tab for output\n");
1.14      harris41  960:          print(OUT $line2insert);
1.13      harris41  961:        close(OUT);
1.15      harris41  962:       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
1.13      harris41  963:       # email appropriate message
1.34      albertel  964:       `echo "REPLACE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "REPLACE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1.13      harris41  965:     }
                    966:     elsif ($hostidexistflag and $lineexistflag) {
1.15      harris41  967:       print &lt;&lt;END;
                    968: Entry exists in ${lonCluster}_hosts.tab.
                    969: END
                    970:       `ln -s ${lonCluster}_hosts.tab ../hosts.tab`;
                    971:       # email appropriate message
                    972:       `echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1.13      harris41  973:     }
1.15      harris41  974:     elsif (!$hostidexistflag and !$lineexistflag) {
                    975:       print &lt;&lt;END;
                    976: New entry for $lonCluster.
1.6       harris41  977: END
1.15      harris41  978:       `cat ../${lonCluster}_hosts.tab &gt; ../new_${lonCluster}_hosts.tab`;
1.21      albertel  979:        open(OUT,'&gt;&gt;../new_'.$lonCluster.'_hosts.tab') or
                    980:          die("cannot open loncom/new_${lonCluster}_hosts.tab for output\n");
1.15      harris41  981:          print(OUT $line2insert);
                    982:        close(OUT);
                    983:       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
                    984:       # email appropriate message
                    985:       `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1.27      albertel  986:     }
                    987:   }
                    988:   $lineexistflag=0;
                    989:   if ($flag==1) {
                    990:     `rm -f ../domain.tab`;
                    991:     open(IN,'&lt;../'.$lonCluster.'_domain.tab');
                    992:     while(&lt;IN&gt;) {
                    993:       if (/^$domaininsert$/) {
                    994:         $lineexistflag=1;
                    995:       }
                    996:       if (/^$perlvar{'lonDefDomain'}\:/) {
                    997:         $domainexistflag=1;
                    998:       }
                    999:     }
                   1000:     close(IN);
                   1001:     if ($domainexistflag and !$lineexistflag) {
                   1002:       print &lt;&lt;END;
                   1003: WARNING: $perlvar{'lonDefDomain'} already exists inside
                   1004: loncapa/loncom/${lonCluster}_domain.tab.  The entry inside
                   1005: ${lonCluster}_domain.tab does not match your settings.
                   1006: The entry inside ${lonCluster}_domain.tab is being replaced
                   1007: with your new values.
                   1008: END
                   1009:       `grep -v "$perlvar{'lonDefDomain'}:" ../${lonCluster}_domain.tab &gt; ../new_${lonCluster}_domain.tab`;
                   1010:        open(OUT,'&gt;&gt;../new_'.$lonCluster.'_domain.tab') or
                   1011:          die("cannot open loncom/${lonCluster}_domain.tab for output\n");
                   1012:          print(OUT $domaininsert);
                   1013:        close(OUT);
                   1014:       `ln -s new_${lonCluster}_domain.tab ../domain.tab`;
                   1015:       # email appropriate message
1.34      albertel 1016:       `echo "REPLACEdom:$lonCluster:$lonHostID:$date:$domaninsert" | mail -s "REPLACEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1.27      albertel 1017:     }
                   1018:     elsif ($domainexistflag and $lineexistflag) {
                   1019:       print &lt;&lt;END;
                   1020: Entry exists in ${lonCluster}_domain.tab.
                   1021: END
                   1022:       `ln -s ${lonCluster}_domain.tab ../domain.tab`;
                   1023:       # email appropriate message
                   1024:       `echo "STABLEUPDATEdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "STABLEUPDATEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
                   1025:     }
                   1026:     elsif (!$domainexistflag and !$lineexistflag) {
                   1027:       print &lt;&lt;END;
                   1028: New entry for $lonCluster.
                   1029: END
                   1030:       `cat ../${lonCluster}_domain.tab &gt; ../new_${lonCluster}_domain.tab`;
                   1031:        open(OUT,'&gt;&gt;../new_'.$lonCluster.'_domain.tab') or
                   1032:          die("cannot open loncom/new_${lonCluster}_domain.tab for output\n");
                   1033:          print(OUT $domaininsert);
                   1034:        close(OUT);
                   1035:       `ln -s new_${lonCluster}_domain.tab ../domain.tab`;
                   1036:       # email appropriate message
                   1037:       `echo "INSERTdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "INSERTdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1.6       harris41 1038:     }
                   1039:   }
1.1       harris41 1040: }
                   1041: </perlscript>
                   1042: </file>
                   1043: </files>
                   1044: </piml>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.