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

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 10 Oct 2005 02:30:48 -0000


This is a MIME encoded message

--raeburn1128911448
Content-Type: text/plain

raeburn		Sun Oct  9 22:30:48 2005 EDT

  Modified files:              
    /doc/loncapafiles	chkconfig.piml modify_config_files.piml 
                     	webserver.piml 
  Log:
  Changes to support SuSE distributions.
  
  
--raeburn1128911448
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20051009223048.txt"

Index: doc/loncapafiles/chkconfig.piml
diff -u doc/loncapafiles/chkconfig.piml:1.1 doc/loncapafiles/chkconfig.piml:1.2
--- doc/loncapafiles/chkconfig.piml:1.1	Thu Dec 16 15:14:37 2004
+++ doc/loncapafiles/chkconfig.piml	Sun Oct  9 22:30:46 2005
@@ -3,7 +3,7 @@
 <!-- phpcheck.piml -->
 <!-- Matthew Hall -->
 
-<!-- $Id: chkconfig.piml,v 1.1 2004/12/16 20:14:37 matthew Exp $ -->
+<!-- $Id: chkconfig.piml,v 1.2 2005/10/10 02:30:46 raeburn Exp $ -->
 
 <!--
 
@@ -38,13 +38,19 @@
 my $chkconfig_bin = '/sbin/chkconfig';
 exit if (! -x $chkconfig_bin);
 
-my $command = $chkconfig_bin.' --list httpd';
+my $webserver = 'httpd';
+my @runlevels = qw/3 4 5/;
+if ('<DIST />' eq 'suse9.3' || '<DIST />' eq 'suse9.2' || '<DIST />' eq 'sles9') {
+    $webserver = 'apache';
+    @runlevels = qw/3 5/;
+}
+my $command = $chkconfig_bin.' --list '.$webserver;
 my $results = `$command`;
 if ($results eq '') {
-    print "**** WARNING: httpd is not set to run on boot.$/".
+    print "**** WARNING: $webserver is not set to run on boot.$/".
         "    Execute the following commands to fix this:".$/.
-        "        $chkconfig_bin --add httpd".$/.
-        "        $chkconfig_bin httpd on".$/;
+        "        $chkconfig_bin --add $webserver".$/.
+        "        $chkconfig_bin $webserver on".$/;
 } else {
     my %httpd_runlevels;
     for (my $rl = 0;$rl &lt;=6;$rl++) {
@@ -52,16 +58,16 @@
     }
     #
     my $warning;
-    foreach my $rl (qw/3 4 5/) {
+    foreach my $rl (@runlevels) {
         if (! exists($httpd_runlevels{$rl}) ) {
             $warning .= 
-               "**** WARNING: httpd is not set to run at runlevel $rl".$/;
+               "**** WARNING: $webserver is not set to run at runlevel $rl".$/;
         }
     }
     if ($warning) {
         print $warning.
             "    Execute the following command to fix this:".$/.
-            "        /sbin/chkconfig httpd on ".$/;
+            "        /sbin/chkconfig $webserver on ".$/;
     }
 }
 
@@ -79,7 +85,7 @@
     }
     #
     $warning = '';
-    foreach my $rl (qw/3 4 5/) {
+    foreach my $rl (@runlevels) {
         if (! exists($loncontrol_runlevels{$rl})) {
             $warning .= 
                 "**** WARNING: loncontrol is not set to run at runlevel $rl\n";
Index: doc/loncapafiles/modify_config_files.piml
diff -u doc/loncapafiles/modify_config_files.piml:1.3 doc/loncapafiles/modify_config_files.piml:1.4
--- doc/loncapafiles/modify_config_files.piml:1.3	Mon Aug 23 15:48:48 2004
+++ doc/loncapafiles/modify_config_files.piml	Sun Oct  9 22:30:46 2005
@@ -3,7 +3,7 @@
 <!-- accesscount_seed.piml -->
 <!-- Matthew Hall -->
 
-<!-- $Id: modify_config_files.piml,v 1.3 2004/08/23 19:48:48 matthew Exp $ -->
+<!-- $Id: modify_config_files.piml,v 1.4 2005/10/10 02:30:46 raeburn Exp $ -->
 
 <!--
 
@@ -35,14 +35,19 @@
 <file>
 <target dist="default">/</target>
 <perlscript mode="fg">
-
-print "\nUpdating yum and MySQL configuration files\n";
+my $mysqldaemon = 'mysqld';
+my $configfiles = 'yum and MySQL';
+if ('<DIST />' eq 'suse9.2' || '<DIST />' eq 'suse9.3' || '<DIST />' eq 'sles9') {
+     $mysqldaemon = 'mysql';
+     $configfiles = 'MySQL';   
+}
+print "\nUpdating $configfiles configuration files\n";
 system("/home/httpd/perl/modify_config_files.pl");
 my $returnvalue = $?>>8;
 if ($returnvalue == 1) {
     ## the /etc/my.cnf file was modified.
     print "**** WARNING: You need to restart MySQL at this time.\n".
-        "    Use the command \"/etc/init.d/mysqld restart\"\n";
+        "    Use the command \"/etc/init.d/$mysqldaemon restart\"\n";
 }
 </perlscript>
 </file>
Index: doc/loncapafiles/webserver.piml
diff -u doc/loncapafiles/webserver.piml:1.17 doc/loncapafiles/webserver.piml:1.18
--- doc/loncapafiles/webserver.piml:1.17	Tue Dec 21 13:37:22 2004
+++ doc/loncapafiles/webserver.piml	Sun Oct  9 22:30:46 2005
@@ -2,7 +2,7 @@
 	"http://lpml.sourceforge.net/DTD/piml.dtd">
 <!-- webserver.piml -->
 
-<!-- $Id: webserver.piml,v 1.17 2004/12/21 18:37:22 matthew Exp $ -->
+<!-- $Id: webserver.piml,v 1.18 2005/10/10 02:30:46 raeburn Exp $ -->
 
 <!--
 
@@ -45,7 +45,7 @@
 <files>
 <file>
 <target dist='default'>/etc/httpd/conf/httpd.conf</target>
-<note>This is always expected for any version of Apache</note>
+<note>This is for Apache 1.X for Red Hat and Fedora distributions</note>
 <dependencies dist='default'>
 /etc/httpd/conf/httpd.conf
 </dependencies>
@@ -91,25 +91,90 @@
     print(OUT $in."\n");
     close(OUT);
   }
+
+# Checking for overlapping ScriptAlias and DocumentRoot definitions.
+  $scriptalias_flag=0;
+  $documentroot_flag=0;
+  my $scriptalias;
+  my $documentroot;
+  open(IN,'&lt;<TARGET />');
+  while (&lt;IN&gt;) {
+    if (m!^\s*ScriptAlias\s+/cgi-bin/\s+(.*)$!) {
+      $scriptalias = $1;
+      if ($scriptalias !~ m!home/httpd/cgi-bin!) {
+        $scriptalias_flag = 1;
+      }
+    }
+    if (m!^\s*DocumentRoot\s+(.*)$!) {
+      $documentroot = $1;
+      if ($documentroot !~ m!home/httpd/html!) {
+        $documentroot_flag = 1;
+      }
+    }
+  }
+  close(IN);
+  if ($scriptalias_flag==1) {
+    print('**** ERROR **** /etc/httpd/conf/httpd.conf has an overlapping definition of '.
+          'ScriptAlias (it is incorrectly set to '.$scriptalias.').'."\n".
+          'This conflicts with loncapa_apache.conf.'."\n");
+  }
+  if ($documentroot_flag==1) {
+    print('**** ERROR **** /etc/httpd/conf/httpd.conf has an overlapping definition of '.
+          'DocumentRoot (it is incorrectly set to '.$documentroot.').'."\n".
+          'This conflicts with loncapa_apache.conf.'."\n");
+  }
 }
 </perlscript>
-</file>
-<file>
-<target dist='default'>/etc/httpd/conf/httpd.conf</target>
-<note>This is always expected for any version of Apache</note>
-<dependencies dist='default'>
-/etc/httpd/conf/httpd.conf
+<target dist='suse9.2 suse9.3 sles9'>/etc/httpd/httpd.conf</target>
+<note>This is for Apache 1.X for SuSE distributions</note>
+<dependencies dist='suse9.2 suse9.3 sles9'>
+/etc/httpd/httpd.conf
 </dependencies>
-<perlscript mode='fg'>
+<perlscript mode='fg' dist='suse9.2 suse9.3 sles9'>
 # Generated from doc/loncapafiles/webserver.piml
 # Trying to check for overlapping DocumentRoot or ScriptAlias definitions.
 unless (-e "<TARGET />") {
-  print '**** ERROR **** /etc/httpd/conf/httpd.conf should exist! Are you missing the Apache '.
+  print '**** ERROR **** /etc/httpd/httpd.conf should exist! Are you missing the Apache '.
     'software package?';
   exit(1);
 }
 else {
   # Append loncapa_apache.conf inclusion to httpd.conf if not present.
+  $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);
+  }
+  # Remove loncapa.conf inclusion from httpd.conf if present.
+  $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);
+  }
+
+  # Checking for overlapping ScriptAlias and DocumentRoot definitions.
   $scriptalias_flag=0;
   $documentroot_flag=0;
   my $scriptalias;
@@ -131,14 +196,14 @@
   }
   close(IN);
   if ($scriptalias_flag==1) {
-    print('**** ERROR **** /etc/httpd/conf/httpd.conf has an overlapping definition of '.
+    print('**** ERROR **** /etc/httpd/httpd.conf has an overlapping definition of '.
           'ScriptAlias (it is incorrectly set to '.$scriptalias.').'."\n".
-	  'This conflicts with loncapa_apache.conf.'."\n");
+	  'This conflicts with conf/loncapa_apache.conf.'."\n");
   }
   if ($documentroot_flag==1) {
-    print('**** ERROR **** /etc/httpd/conf/httpd.conf has an overlapping definition of '.
+    print('**** ERROR **** /etc/httpd/httpd.conf has an overlapping definition of '.
           'DocumentRoot (it is incorrectly set to '.$documentroot.').'."\n".
-	  'This conflicts with loncapa_apache.conf.'."\n");
+	  'This conflicts with conf/loncapa_apache.conf.'."\n");
   }
 }
 </perlscript>

--raeburn1128911448--