[LON-CAPA-cvs] cvs: doc /loncapafiles updatequery.piml

harris41 lon-capa-cvs@mail.lon-capa.org
Mon, 13 May 2002 01:09:26 -0000


harris41		Sun May 12 21:09:26 2002 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  a step closer regarding BUG 327
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.4 doc/loncapafiles/updatequery.piml:1.5
--- doc/loncapafiles/updatequery.piml:1.4	Sun May 12 18:31:41 2002
+++ doc/loncapafiles/updatequery.piml	Sun May 12 21:09:26 2002
@@ -1,7 +1,7 @@
 <!-- updatequery.piml -->
 <!-- Scott Harrison -->
 
-<!-- $Id: updatequery.piml,v 1.4 2002/05/12 22:31:41 harris41 Exp $ -->
+<!-- $Id: updatequery.piml,v 1.5 2002/05/13 01:09:26 harris41 Exp $ -->
 
 <!--
 
@@ -60,7 +60,7 @@
            WELCOME TO LON-CAPA!
 
 If you have questions, please visit http://install.lon-capa.org
-or contact sharrison\@install.lon-capa.org.
+or contact sharrison\@mail.lon-capa.org.
 
 ===============================================================================
 The following 4 values are needed to configure LON-CAPA:
@@ -151,8 +151,8 @@
 }
   my $choice=&lt;&gt;;
   chomp($choice);
-  if ($ipdomain and $choice=~/^\s*$/) {
-    $choice=$ipdomain;
+  if ($lonHostID and $choice=~/^\s*$/) {
+    $choice=$lonHostID;
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
     print(OUT 'lonHostID'."\t".$choice."\n");
     close(OUT);
@@ -162,7 +162,6 @@
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
     print(OUT 'lonHostID'."\t".$choice."\n");
     close(OUT);
-    $r='l';
     $flag=1;
   }
   else {
@@ -180,6 +179,7 @@
 # get domain name
 # accept if valid, if not valid, tell user and repeat
 $flag=0;
+my $lonDefDomain;
 while (!$flag) {
 if ($ipdomain) {
 print(&lt;&lt;END);
@@ -198,12 +198,14 @@
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
     print(OUT 'lonDefDomain'."\t".$choice."\n");
     close(OUT);
+    $lonDefDomain=$choice;
     $flag=1;
   }
   elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
     print(OUT 'lonDefDomain'."\t".$choice."\n");
     close(OUT);
+    $lonDefDomain=$choice;
     $r='l';
     $flag=1;
   }
@@ -231,7 +233,7 @@
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
     print(OUT 'lonAdmEmail'."\t".$choice."\n");
     close(OUT);
-    my $lonAdmEmail=$choice;
+    $lonAdmEmail=$choice;
     $flag=1;
   }
   else {
@@ -239,31 +241,94 @@
   }
 }
 
-
 # update loncapa.conf
+#my $confdir='/etc/httpd/conf/';
+my $confdir='';
+my $filename='loncapa.conf';
+my %perlvar;
+    if (-e "$confdir$filename") {
+	open(CONFIG,'&lt;'.$confdir.$filename) or die("Can't read $confdir$filename");
+	while (my $configline=&lt;CONFIG&gt;) {
+	    if ($configline =~ /^[^\#]*PerlSetVar/) {
+		my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
+		chomp($varvalue);
+		$perlvar{$varname}=$varvalue;
+	    }
+	}
+	close(CONFIG);
+    }
+    $perlvar{'lonHostID'}=$lonHostID;
+    $perlvar{'lonDefDomain'}=$lonDefDomain;
+    $perlvar{'lonAdmEmail'}=$lonAdmEmail;
+    $perlvar{'lonRole'}=$lonRole;
+    unless ($perlvar{'lonSqlAccess'}) {
+       $perlvar{'lonSqlAccess'}='localhostkey';
+    }
+    unless ($perlvar{'lonLoadLim'}) {
+       $perlvar{'lonLoadLim'}='2.00';
+    }
+    unless ($perlvar{'lonExpire'}) {
+       $perlvar{'lonExpire'}='86400';
+    }
+    unless ($perlvar{'lonReceipt'}) {
+       my $lonReceipt='';
+       srand($$.time);
+       my @alnum=(0..9,a..z);
+       foreach my $i (1..20) {
+	 $lonReceipt.=$alnum[int(rand(36))];
+       }
+       $perlvar{'lonReceipt'}=$lonReceipt;
+    }
+    open(OUT,"&gt;$confdir$filename") or
+      die("Cannot output to $confdir$filename\n");
+    foreach my $key (keys %perlvar) {
+      my $value=$perlvar{$key};
+      print(OUT &lt;&lt;END);
+PerlSetVar     $key      $value
+END
+    }
+    close(OUT);
 }
 </perlscript>
 </file>
 <file>
-<target dist='default'>/home/httpd/lonUsers2</target>
+<target dist='default'>/</target>
 <perlscript mode='fg'>
 # read values from loncapa.conf
+#my $confdir='/etc/httpd/conf/';
+my $confdir='';
+my $filename='loncapa.conf';
+my %perlvar;
+    if (-e "$confdir$filename") {
+	open(CONFIG,'&lt;'.$confdir.$filename) or 
+          die("Can't read $confdir$filename");
+	while (my $configline=&lt;CONFIG&gt;) {
+	    if ($configline =~ /^[^\#]*PerlSetVar/) {
+		my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
+		chomp($varvalue);
+		$perlvar{$varname}=$varvalue;
+	    }
+	}
+	close(CONFIG);
+    }
   print(&lt;&lt;END);
 
 ===============================================================================
 This is now the current configuration of your machine.
-1) Machine Name: $perlsetvar{'lonHostID'}
-2) Domain Name: $perlsetvar{'lonDefDomain'}
-3) System Administrator's E-mail Address: $perlsetvar{'lonAdmEmail'}
-4) Role: $perlsetvar{'lonRole'}
-5) Cache Expiration Time: $perlsetvar{'lonExpire'}
-6) Server Load: $perlsetvar{'lonLoadLim'}
+1) Machine Name: $perlvar{'lonHostID'}
+2) Domain Name: $perlvar{'lonDefDomain'}
+3) System Administrator's E-mail Address: $perlvar{'lonAdmEmail'}
+4) Role: $perlvar{'lonRole'}
+5) Cache Expiration Time: $perlvar{'lonExpire'}
+6) Server Load: $perlvar{'lonLoadLim'}
 7) Everything is correct up above
 ENTER A CHOICE OF 1-6 TO CHANGE, otherwise ENTER 7:
 END
 
 # implement editing logic below, interactively
 # update loncapa.conf until 7 is entered
+my $choice=&lt;&gt;;
+chomp($choice);
 
 </perlscript>
 </file>
@@ -281,10 +346,12 @@
 
 1) PRODUCTION - you want to deliver courses today or sometime very soon
                 on this machine
-2) DEVELOPMENT - you want to play with or explore LON-CAPA
-3) Do not install hosts.tab right now
+2) STAND-ALONE - you want this machine to run in 'stand-alone' mode and
+                 not be connected to other LON-CAPA machines for now
+3) DEVELOPMENT - you want to play with or explore LON-CAPA
+4) Do not install hosts.tab right now
 
-ENTER 1, 2, or 3:
+ENTER 1, 2, 3, or 4:
 END
 # Option number 26 will install rawhide_hosts.tab, but
 # the typical user does not want to be part of an intensive
@@ -292,6 +359,8 @@
 
 # get input
 # if valid then process, otherwise loop
+my $choice=&lt;&gt;;
+chomp($choice);
 
 }
 </perlscript>