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

1.2       harris41    1: <!-- updatequery.piml -->
1.1       harris41    2: <!-- Scott Harrison -->
                      3: 
1.4     ! harris41    4: <!-- $Id: updatequery.piml,v 1.3 2002/05/12 19:25:15 harris41 Exp $ -->
1.1       harris41    5: 
                      6: <!--
                      7: 
                      8: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: 
                     10: LON-CAPA is free software; you can redistribute it and/or modify
                     11: it under the terms of the GNU General Public License as published by
                     12: the Free Software Foundation; either version 2 of the License, or
                     13: (at your option) any later version.
                     14: 
                     15: LON-CAPA is distributed in the hope that it will be useful,
                     16: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: GNU General Public License for more details.
                     19: 
                     20: You should have received a copy of the GNU General Public License
                     21: along with LON-CAPA; if not, write to the Free Software
                     22: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: 
                     24: /home/httpd/html/adm/gpl.txt
                     25: 
                     26: http://www.lon-capa.org/
                     27: 
                     28: -->
                     29: 
                     30: <piml>
                     31: <targetroot>/</targetroot>
                     32: <files>
                     33: <file>
1.4     ! harris41   34: <target dist='default'>/</target>
1.1       harris41   35: <perlscript mode='fg'>
1.4     ! harris41   36: $|=1;
1.1       harris41   37:   print(&lt;&lt;END);
                     38: 
                     39: 
                     40: *********************************************
                     41: *********************************************
                     42: ****                                     ****
                     43: **** LON-CAPA SYSTEM INFORMATION REQUEST ****
                     44: ****                                     ****
                     45: **** Please respond to the choices below ****
                     46: ****                                     ****
                     47: *********************************************
                     48: *********************************************
                     49: 
                     50: END
1.4     ! harris41   51: sleep(3);
1.1       harris41   52: </perlscript>
                     53: </file>
                     54: <file>
1.4     ! harris41   55: <target dist='default'>/home/httpd/lonUsers2/</target>
1.1       harris41   56: <perlscript mode='fg'>
1.4     ! harris41   57: $|=1;
1.1       harris41   58: unless (-e "<TARGET />") {
                     59:   print(&lt;&lt;END);
                     60:            WELCOME TO LON-CAPA!
                     61: 
                     62: If you have questions, please visit http://install.lon-capa.org
1.4     ! harris41   63: or contact sharrison\@install.lon-capa.org.
1.1       harris41   64: 
                     65: ===============================================================================
1.4     ! harris41   66: The following 4 values are needed to configure LON-CAPA:
        !            67: * Machine Role
1.1       harris41   68: * Machine ID Name
                     69: * LON-CAPA Domain Name, and
                     70: * System Administration E-mail Address.
                     71: END
1.3       harris41   72: 
1.4     ! harris41   73: open(OUT,'&gt;/tmp/loncapa_updatequery.out');
        !            74: close(OUT);
        !            75: 
1.3       harris41   76: # query for Machine Role
                     77:   print(&lt;&lt;END);
                     78: **** Machine Role ****
                     79: Library server (recommended if first-time installation of LON-CAPA):
                     80:    Servers that are repositories of authoritative educational resources.
                     81:    These servers also provide the construction space by which instructors
                     82:    assemble their classroom online material.
                     83: Access server:
                     84:    Servers that load-balance high-traffic delivery of educational resources
                     85:    over the world-wide web.
1.4     ! harris41   86: 1) Will this be a library server? (recommended if this is your first install)
1.3       harris41   87: 2) Or, will this be an access server?
                     88: END
1.4     ! harris41   89: my $flag=0;
        !            90: my $r='';
        !            91: my $lonRole;
        !            92: while (!$flag) {
        !            93:   print "ENTER A CHOICE OF 1 or 2:\n";
        !            94:   my $choice=&lt;&gt;;
        !            95:   chomp($choice);
        !            96:   if ($choice==1) {
        !            97:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
        !            98:     print(OUT 'lonRole'."\t".'library'."\n");
        !            99:     close(OUT);
        !           100:     $lonRole='library';
        !           101:     $r='l';
        !           102:     $flag=1;
        !           103:   }
        !           104:   elsif ($choice==2) {
        !           105:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
        !           106:     print(OUT 'lonRole'."\t".'access'."\n");
        !           107:     close(OUT);
        !           108:     $lonRole='access';
        !           109:     $r='a';
        !           110:     $flag=2;
        !           111:   }
        !           112:   else {
        !           113: 
        !           114:   }
        !           115: }
1.3       harris41  116: 
                    117: # need to recommend a machine ID name (ipdomain.l.somenumber)
1.4     ! harris41  118: my $hostname=`hostname`; chomp($hostname);
        !           119: my $ipdomain='';
        !           120: if ($hostname=~/([^\.]*)\.([^\.]*)$/) {
        !           121:   $ipdomain=$1;
        !           122: }
        !           123: my $lonHostID;
        !           124: if ($ipdomain) {
        !           125:   $lonHostID=$ipdomain.$r.int(1+rand(9)); # should be probably detect against
        !           126:                                           # the hosts.tab
        !           127: }
1.1       harris41  128: 
                    129:   print(&lt;&lt;END);
                    130: 
                    131: **** Machine ID Name ****
                    132: [this does NOT need to correspond to internet address names;
                    133:  this name MUST be unique to the whole LON-CAPA network;
                    134:  we recommend that you use a name based off of your institution;
                    135:  good examples: "msul1" or "bionetl1";
                    136:  bad examples: "loncapabox" or "studentsinside"]
                    137: END
                    138: # get machine name
                    139: # accept if valid, if not valid, tell user and repeat
1.4     ! harris41  140: $flag=0;
        !           141: while (!$flag) {
        !           142: if ($ipdomain) {
        !           143: print(&lt;&lt;END);
        !           144: ENTER LONCAPA MACHINE ID [$lonHostID]:
        !           145: END
        !           146: }
        !           147: else {
        !           148:   print(&lt;&lt;END);
        !           149: ENTER LONCAPA MACHINE ID:
        !           150: END
        !           151: }
        !           152:   my $choice=&lt;&gt;;
        !           153:   chomp($choice);
        !           154:   if ($ipdomain and $choice=~/^\s*$/) {
        !           155:     $choice=$ipdomain;
        !           156:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
        !           157:     print(OUT 'lonHostID'."\t".$choice."\n");
        !           158:     close(OUT);
        !           159:     $flag=1;
        !           160:   }
        !           161:   elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
        !           162:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
        !           163:     print(OUT 'lonHostID'."\t".$choice."\n");
        !           164:     close(OUT);
        !           165:     $r='l';
        !           166:     $flag=1;
        !           167:   }
        !           168:   else {
        !           169:     print "Invalid input (only alphanumeric characters supported).\n";
        !           170:   }
        !           171: }
1.1       harris41  172: 
                    173:   print(&lt;&lt;END);
                    174: 
                    175: **** Domain ****
                    176: [this does NOT need to correspond to internet address domains,
                    177:  examples might be "msu" or "bionet" or "vermontcc"]
                    178: END
                    179: 
                    180: # get domain name
                    181: # accept if valid, if not valid, tell user and repeat
1.4     ! harris41  182: $flag=0;
        !           183: while (!$flag) {
        !           184: if ($ipdomain) {
        !           185: print(&lt;&lt;END);
        !           186: ENTER LONCAPA DOMAIN [$ipdomain]:
        !           187: END
        !           188: }
        !           189: else {
        !           190:   print(&lt;&lt;END);
        !           191: ENTER LONCAPA DOMAIN:
        !           192: END
        !           193: }
        !           194:   my $choice=&lt;&gt;;
        !           195:   chomp($choice);
        !           196:   if ($ipdomain and $choice=~/^\s*$/) {
        !           197:     $choice=$ipdomain;
        !           198:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
        !           199:     print(OUT 'lonDefDomain'."\t".$choice."\n");
        !           200:     close(OUT);
        !           201:     $flag=1;
        !           202:   }
        !           203:   elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
        !           204:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
        !           205:     print(OUT 'lonDefDomain'."\t".$choice."\n");
        !           206:     close(OUT);
        !           207:     $r='l';
        !           208:     $flag=1;
        !           209:   }
        !           210:   else {
        !           211:     print "Invalid input (only alphanumeric characters supported).\n";
        !           212:   }
        !           213: }
1.1       harris41  214: 
1.4     ! harris41  215: # get e-mail address
        !           216: # accept if valid, if not valid, tell user and repeat
        !           217: $flag=0;
        !           218: my $lonAdmEmail;
        !           219: while (!$flag) {
1.1       harris41  220:   print(&lt;&lt;END);
                    221: 
                    222: **** System Administrator's E-mail ****
                    223: E-mail address of the person who will manage this machine
1.4     ! harris41  224: [should be in the form somebody\@somewhere]
1.1       harris41  225: ENTER E-MAIL ADDRESS:
                    226: END
                    227: 
1.4     ! harris41  228:   my $choice=&lt;&gt;;
        !           229:   chomp($choice);
        !           230:   if ($choice=~/\@/) {
        !           231:     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
        !           232:     print(OUT 'lonAdmEmail'."\t".$choice."\n");
        !           233:     close(OUT);
        !           234:     my $lonAdmEmail=$choice;
        !           235:     $flag=1;
        !           236:   }
        !           237:   else {
        !           238:     print "Invalid input (this needs to look like an e-mail address!).\n";
        !           239:   }
        !           240: }
        !           241: 
        !           242: 
1.1       harris41  243: # update loncapa.conf
                    244: }
                    245: </perlscript>
                    246: </file>
                    247: <file>
                    248: <target dist='default'>/home/httpd/lonUsers2</target>
                    249: <perlscript mode='fg'>
                    250: # read values from loncapa.conf
                    251:   print(&lt;&lt;END);
                    252: 
                    253: ===============================================================================
                    254: This is now the current configuration of your machine.
                    255: 1) Machine Name: $perlsetvar{'lonHostID'}
                    256: 2) Domain Name: $perlsetvar{'lonDefDomain'}
                    257: 3) System Administrator's E-mail Address: $perlsetvar{'lonAdmEmail'}
                    258: 4) Role: $perlsetvar{'lonRole'}
                    259: 5) Cache Expiration Time: $perlsetvar{'lonExpire'}
                    260: 6) Server Load: $perlsetvar{'lonLoadLim'}
                    261: 7) Everything is correct up above
                    262: ENTER A CHOICE OF 1-6 TO CHANGE, otherwise ENTER 7:
                    263: END
                    264: 
                    265: # implement editing logic below, interactively
                    266: # update loncapa.conf until 7 is entered
                    267: 
                    268: </perlscript>
                    269: </file>
                    270: <file>
                    271: <target dist='default'>loncom/hosts.tab</target>
                    272: <perlscript mode='fg'>
                    273: unless (-l "<TARGET />") {
                    274:   print(&lt;&lt;END);
                    275: 
                    276: ===============================================================================
                    277: What hosts.tab would you like to have installed?
                    278: (hosts.tab is a listing of all other internet machines
                    279: that a server system considers to be valid server systems
                    280: on the LON-CAPA network)
                    281: 
                    282: 1) PRODUCTION - you want to deliver courses today or sometime very soon
                    283:                 on this machine
                    284: 2) DEVELOPMENT - you want to play with or explore LON-CAPA
                    285: 3) Do not install hosts.tab right now
                    286: 
                    287: ENTER 1, 2, or 3:
                    288: END
                    289: # Option number 26 will install rawhide_hosts.tab, but
                    290: # the typical user does not want to be part of an intensive
                    291: # machine test cluster.
                    292: 
                    293: # get input
                    294: # if valid then process, otherwise loop
                    295: 
                    296: }
                    297: </perlscript>
                    298: </file>
                    299: </files>
                    300: </piml>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>