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

harris41 lon-capa-cvs@mail.lon-capa.org
Thu, 16 May 2002 01:22:38 -0000


harris41		Wed May 15 21:22:38 2002 EDT

  Modified files:              
    /doc/loncapafiles	webserver.piml 
  Log:
  BUG 129; BUG 437; need to fix intelligent configuration of
  web server files; specifically do NOT create access.conf 
  and srm.conf files if they do NOT exist; also do NOT
  Include conf/loncapa.conf; ONLY include conf/loncapa_apache.conf;
  if conf/loncapa.conf is included, then remove it; also beautified
  the code; SUPER-DOUBLY-EXTRA-FIXED
  
  
Index: doc/loncapafiles/webserver.piml
diff -u doc/loncapafiles/webserver.piml:1.10 doc/loncapafiles/webserver.piml:1.11
--- doc/loncapafiles/webserver.piml:1.10	Mon May 13 05:07:05 2002
+++ doc/loncapafiles/webserver.piml	Wed May 15 21:22:38 2002
@@ -3,7 +3,7 @@
 <!-- webserver.piml -->
 <!-- Scott Harrison -->
 
-<!-- $Id: webserver.piml,v 1.10 2002/05/13 09:07:05 harris41 Exp $ -->
+<!-- $Id: webserver.piml,v 1.11 2002/05/16 01:22:38 harris41 Exp $ -->
 
 <!--
 
@@ -51,55 +51,63 @@
 /etc/httpd/conf/httpd.conf
 </dependencies>
 <perlscript mode='fg'>
+# Generated from doc/loncapafiles/webserver.piml
 unless (-e "<TARGET />") {
-	print 'ERROR! httpd.conf should exist! Are you missing the Apache '.
-		'software package';
+  print 'ERROR! httpd.conf should exist! Are you missing the Apache '.
+    'software package';
+  exit(1);
 }
 else {
   $flag=0;
   open IN, "&lt;<TARGET />";
   while (&lt;IN&gt;) { if (/^\s*Include\s+conf\/srm.conf/) { $flag=1; } }
   close IN;
-  unless ($flag==1) {
-	open OUT,"&gt;&gt;<TARGET />";
-	print OUT 'Include conf/srm.conf'."\n";
-	close OUT;
+  if ($flag!=1 and -e '/etc/httpd/conf/srm.conf') {
+    open OUT,"&gt;&gt;<TARGET />";
+    print OUT 'Include conf/srm.conf'."\n";
+    close OUT;
   }
   $flag=0;
   open IN, "&lt;<TARGET />";
   while (&lt;IN&gt;) { if (/^\s*Include\s+conf\/access.conf/) { $flag=1; } }
   close IN;
-  unless ($flag==1) {
-	open OUT,"&gt;&gt;<TARGET />";
-	print OUT 'Include conf/access.conf'."\n";
-	close OUT;
+  if ($flag!=1 and -e '/etc/httpd/conf/access.conf') {
+    open(OUT,'&gt;&gt;<TARGET />');
+    print(OUT 'Include conf/access.conf'."\n");
+    close(OUT);
   }
   my $eflag=0;
   $flag=0;
-  open IN, "&lt;<TARGET />";
+  open(IN,'&lt;<TARGET />');
   while (&lt;IN&gt;) { 
     if (/^\s*Include\s+conf\/loncapa_apache.conf/) {
       $flag=1; 
     }
   }
-  close IN;
+  close(IN);
   unless ($flag==1) {
-	open OUT,"&gt;&gt;<TARGET />";
-	print OUT 'Include conf/loncapa_apache.conf'."\n";
-	close OUT;
+    open(OUT,'&gt;&gt;<TARGET />');
+    print(OUT 'Include conf/loncapa_apache.conf'."\n");
+    close(OUT);
   }
   $flag=0;
-  open IN, "&lt;<TARGET />";
-  while (&lt;IN&gt;) { 
+  open(IN,'&lt;<TARGET />');
+  while (&lt;IN&gt;) {
     if (/^\s*Include\s+conf\/loncapa.conf/) {
-      $flag=1; 
+      $flag=1;
     }
   }
-  close IN;
-  unless ($flag==1) {
-	open OUT,"&gt;&gt;<TARGET />";
-	print OUT 'Include conf/loncapa.conf'."\n";
-	close OUT;
+  close(IN);
+  $in='';
+  if ($flag==1) {
+    open(IN,'&lt;<TARGET />');
+    while(&lt;IN&gt;) {
+      $in.=$_ unless /^\s*Include\s+conf\/loncapa.conf/;
+    }
+    close(IN);
+    open(OUT,'&gt;<TARGET />');
+    print(OUT $in."\n");
+    close(OUT);
   }
 }
 </perlscript>
@@ -112,37 +120,35 @@
 /etc/httpd/conf/access.conf
 </dependencies>
 <perlscript mode='fg'>
-unless (-e "<TARGET />") {
-	print &lt;&lt;END;
-WARNING! access.conf is not currently present on your system.
-This is either due to 
-* you are missing the Apache software package,
-* you have a newer version of Apache that does not
-  ordinarily install an access.conf
-* configuration files are installed in a directory location
-  different than for <TARGET />
-For backwards compatibility,
-<TARGET /> is being generated.
-END
-}
-my $flag=0;
-open IN, "&lt;<TARGET />";
-while (&lt;IN&gt;) { if (/^\s*Include\s+conf\/loncapa_apache.conf/)
-	 { $flag=1; } }
-close IN;
-unless ($flag==1) {
-open OUT,"&gt;&gt;<TARGET />";
-print OUT 'Include conf/loncapa_apache.conf'."\n";
-close OUT;
-}
-$flag=0;
-open IN, "&lt;<TARGET />";
-while (&lt;IN&gt;) { if (/^\s*Include\s+conf\/loncapa.conf/) { $flag=1; } }
-close IN;
-unless ($flag==1) {
-open OUT,"&gt;&gt;<TARGET />";
-print OUT 'Include conf/loncapa.conf'."\n";
-close OUT;
+if (-e '<TARGET />') {
+  my $flag=0;
+  open(IN,'&lt;<TARGET />');
+  while (&lt;IN&gt;) {
+    if (/^\s*Include\s+conf\/loncapa_apache.conf/) {
+      $flag=1;
+    }
+  }
+  close(IN);
+  unless ($flag==1) {
+    open(OUT,'&gt;&gt;<TARGET />');
+    print(OUT 'Include conf/loncapa_apache.conf'."\n");
+    close(OUT);
+  }
+  $flag=0;
+  open(IN,'&lt;<TARGET />');
+  while (&lt;IN&gt;) { if (/^\s*Include\s+conf\/loncapa.conf/) { $flag=1; } }
+  close(IN);
+  $in='';
+  if ($flag==1) {
+    open(IN,'&lt;<TARGET />');
+    while(&lt;IN&gt;) {
+      $in.=$_ unless /^\s*Include\s+conf\/loncapa.conf/;
+    }
+    close(IN);
+    open(OUT,'&gt;<TARGET />');
+    print(OUT $in."\n");
+    close(OUT);
+  }
 }
 </perlscript>
 </file>
@@ -154,37 +160,39 @@
 /etc/httpd/conf/srm.conf
 </dependencies>
 <perlscript mode='fg'>
-unless (-e "<TARGET />") {
-	print &lt;&lt;END;
-WARNING! srm.conf is not currently present on your system.
-This is either due to 
-* you are missing the Apache software package,
-* you have a newer version of Apache that does not
-  ordinarily install an srm.conf
-* configuration files are installed in a directory location
-  different than for <TARGET />
-For backwards compatibility,
-<TARGET /> is being generated.
-END
-}
-my $flag=0;
-open IN, "&lt;<TARGET />";
-while (&lt;IN&gt;) { if (/^\s*Include\s+conf\/loncapa_apache.conf/)
- { $flag=1; } }
-close IN;
-unless ($flag==1) {
-open OUT,"&gt;&gt;<TARGET />";
-print OUT 'Include conf/loncapa_apache.conf'."\n";
-close OUT;
-}
-$flag=0;
-open IN, "&lt;<TARGET />";
-while (&lt;IN&gt;) { if (/^\s*Include\s+conf\/loncapa.conf/) { $flag=1; } }
-close IN;
-unless ($flag==1) {
-open OUT,"&gt;&gt;<TARGET />";
-print OUT 'Include conf/loncapa.conf'."\n";
-close OUT;
+if (-e '<TARGET />') {
+  my $flag=0;
+  open(IN,'&lt;<TARGET />');
+  while (&lt;IN&gt;) {
+    if (/^\s*Include\s+conf\/loncapa_apache.conf/) {
+      $flag=1;
+    }
+  }
+  close(IN);
+  unless ($flag==1) {
+    open(OUT,'&gt;&gt;<TARGET />');
+    print(OUT 'Include conf/loncapa_apache.conf'."\n");
+    close(OUT);
+  }
+  $flag=0;
+  open(IN,'&lt;<TARGET />');
+  while (&lt;IN&gt;) {
+    if (/^\s*Include\s+conf\/loncapa.conf/) {
+      $flag=1;
+    }
+  }
+  close(IN);
+  $in='';
+  if ($flag==1) {
+    open(IN,'&lt;<TARGET />');
+    while(&lt;IN&gt;) {
+      $in.=$_ unless /^\s*Include\s+conf\/loncapa.conf/;
+    }
+    close(IN);
+    open(OUT,'&gt;<TARGET />');
+    print(OUT $in."\n");
+    close(OUT);
+  }
 }
 </perlscript>
 </file>