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

harris41 lon-capa-cvs@mail.lon-capa.org
Mon, 13 May 2002 02:24:44 -0000


harris41		Sun May 12 22:24:44 2002 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  the power of Roxette music;
  BUG 327 fixed... this should completely query
  the user for information for loncapa.conf...
  also adaptively has a 'new install' mode
  also queries for hosts.tab settings
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.5 doc/loncapafiles/updatequery.piml:1.6
--- doc/loncapafiles/updatequery.piml:1.5	Sun May 12 21:09:26 2002
+++ doc/loncapafiles/updatequery.piml	Sun May 12 22:24:44 2002
@@ -1,7 +1,7 @@
 <!-- updatequery.piml -->
 <!-- Scott Harrison -->
 
-<!-- $Id: updatequery.piml,v 1.5 2002/05/13 01:09:26 harris41 Exp $ -->
+<!-- $Id: updatequery.piml,v 1.6 2002/05/13 02:24:44 harris41 Exp $ -->
 
 <!--
 
@@ -311,6 +311,11 @@
 	}
 	close(CONFIG);
     }
+# implement editing logic below, interactively
+# update loncapa.conf until 7 is entered
+
+$flag=0;
+while (!$flag) {
   print(&lt;&lt;END);
 
 ===============================================================================
@@ -322,14 +327,73 @@
 5) Cache Expiration Time: $perlvar{'lonExpire'}
 6) Server Load: $perlvar{'lonLoadLim'}
 7) Everything is correct up above
+END
+  print(&lt;&lt;END);
 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);
+  if ($choice==1) {
+  print(&lt;&lt;END);
+1) Machine Name: $perlvar{'lonHostID'}
+ENTER NEW VALUE:
+END
+    my $choice2=&lt;&gt;;
+    chomp($choice2);
+    $perlvar{'lonHostID'}=$choice2;
+  }
+  elsif ($choice==2) {
+  print(&lt;&lt;END);
+2) Domain Name: $perlvar{'lonDefDomain'}
+ENTER NEW VALUE:
+END
+    my $choice2=&lt;&gt;;
+    chomp($choice2);
+    $perlvar{'lonDefDomain'}=$choice2;
+  }
+  elsif ($choice==3) {
+  print(&lt;&lt;END);
+3) System Administrator's E-mail Address: $perlvar{'lonAdmEmail'}
+ENTER NEW VALUE:
+END
+    my $choice2=&lt;&gt;;
+    chomp($choice2);
+    $perlvar{'lonAdmEmail'}=$choice2;
+  }
+  elsif ($choice==4) {
+  print(&lt;&lt;END);
+4) Role: $perlvar{'lonRole'}
+ENTER NEW VALUE:
+END
+    my $choice2=&lt;&gt;;
+    chomp($choice2);
+    $perlvar{'lonRole'}=$choice2;
+  }
+  elsif ($choice==5) {
+  print(&lt;&lt;END);
+5) Cache Expiration Time: $perlvar{'lonExpire'}
+ENTER NEW VALUE:
+END
+    my $choice2=&lt;&gt;;
+    chomp($choice2);
+    $perlvar{'lonExpire'}=$choice2;
+  }
+  elsif ($choice==6) {
+  print(&lt;&lt;END);
+6) Server Load: $perlvar{'lonLoadLim'}
+ENTER NEW VALUE:
+END
+    my $choice2=&lt;&gt;;
+    chomp($choice2);
+    $perlvar{'lonLoadLim'}=$choice2;
+  }
+  elsif ($choice==7) {
+    $flag=1;
+  }
+  else {
 
+  }
+}
 </perlscript>
 </file>
 <file>
@@ -349,9 +413,8 @@
 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
+4) PRESERVE the existing hosts.tab (/home/httpd/lonTabs/hosts.tab)
 
-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
@@ -359,8 +422,57 @@
 
 # get input
 # if valid then process, otherwise loop
-my $choice=&lt;&gt;;
-chomp($choice);
+my $hostname=`hostname`;chomp($hostname);
+my $hostaddress=`hostname -i $hostname`;chomp($hostaddress);
+$flag=0;
+while (!$flag) {
+  print "ENTER 1, 2, 3, or 4:\n";
+  my $choice=&lt;&gt;;
+  chomp($choice);
+  if ($choice==1) {
+    $lonCluster='production';
+    `rm -f ../hosts.tab`;
+    `ln -s production_hosts.tab ../hosts.tab`;
+    $flag=1;
+  }
+  elsif ($choice==2) {
+    $lonCluster='standalone';
+    open(OUT,'&gt;../standalone_hosts.tab') or
+      die("cannot open loncom/standalone_hosts.tab for output\n");
+    print(OUT &lt;&lt;END);
+$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress
+END
+    close(OUT);
+    `rm -f ../hosts.tab`;
+    `ln -s standalone_hosts.tab ../hosts.tab`;
+    $flag=1;
+  }
+  elsif ($choice==3) {
+    $lonCluster='development';
+    `rm -f loncom/hosts.tab`;
+    `ln -s development_hosts.tab ../hosts.tab`;
+    $flag=1;
+  }
+  elsif ($choice==4) {
+    $lonCluster='existing';
+    `rm -f ../hosts.tab`;
+    `touch existing_hosts.tab`;
+    if (-e '/home/httpd/lonTabs/hosts.tab') {
+      `cp /home/httpd/lonTabs/hosts.tab ../existing_hosts.tab`;
+    }
+    `ln -s existing_hosts.tab ../hosts.tab`;
+    $flag=1;
+  }
+  elsif ($choice==26) {
+    $lonCluster='rawhide';
+    `rm -f ../hosts.tab`;
+    `ln -s rawhide_hosts.tab ../hosts.tab`;
+    $flag=1;
+  }
+  else {
+
+  }
+}
 
 }
 </perlscript>