File:  [LON-CAPA] / doc / loncapafiles / webserver.piml
Revision 1.14: download - view: text, annotated - select for diffs
Mon Feb 3 18:03:51 2003 UTC (21 years, 2 months ago) by harris41
Branches: MAIN
CVS tags: version_1_1_X, version_1_1_3, version_1_1_2, version_1_1_1, version_1_1_0, version_1_0_99_3, version_1_0_99_2, version_1_0_99_1, version_1_0_99, version_1_0_3, version_1_0_2, version_1_0_1, version_1_0_0, version_0_99_5, version_0_99_4, version_0_99_3, version_0_99_2, version_0_99_1, version_0_99_0, conference_2003, HEAD
best wishes to all.

    1: <!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN" 
    2: 	"http://lpml.sourceforge.net/DTD/piml.dtd">
    3: <!-- webserver.piml -->
    4: 
    5: <!-- $Id: webserver.piml,v 1.14 2003/02/03 18:03:51 harris41 Exp $ -->
    6: 
    7: <!--
    8: 
    9: Copyright Michigan State University Board of Trustees
   10: 
   11: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   12: 
   13: LON-CAPA is free software; you can redistribute it and/or modify
   14: it under the terms of the GNU General Public License as published by
   15: the Free Software Foundation; either version 2 of the License, or
   16: (at your option) any later version.
   17: 
   18: LON-CAPA is distributed in the hope that it will be useful,
   19: but WITHOUT ANY WARRANTY; without even the implied warranty of
   20: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   21: GNU General Public License for more details.
   22: 
   23: You should have received a copy of the GNU General Public License
   24: along with LON-CAPA; if not, write to the Free Software
   25: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   26: 
   27: /home/httpd/html/adm/gpl.txt
   28: 
   29: http://www.lon-capa.org/
   30: 
   31: -->
   32: 
   33: <!-- Default values must be defined before specific values. -->
   34: <!-- If no 'dist' attribute is specified, then it is always installed. -->
   35: <!-- If 'dist' attribute is set to  'default', then the specification. -->
   36: <!-- is accepted if an alternative distribution is not requested or not -->
   37: <!-- defined. -->
   38: 
   39: <piml>
   40: <targetroot>/</targetroot>
   41: <specialnotices>
   42: <specialnotice>
   43: </specialnotice>
   44: </specialnotices>
   45: <files>
   46: <file>
   47: <target dist='default'>/etc/httpd/conf/httpd.conf</target>
   48: <note>This is always expected for any version of Apache</note>
   49: <dependencies dist='default'>
   50: /etc/httpd/conf/httpd.conf
   51: </dependencies>
   52: <perlscript mode='fg'>
   53: # Generated from doc/loncapafiles/webserver.piml
   54: unless (-e "<TARGET />") {
   55:   print 'ERROR! httpd.conf should exist! Are you missing the Apache '.
   56:     'software package?';
   57:   exit(1);
   58: }
   59: else {
   60:   # Append loncapa_apache.conf inclusion to httpd.conf if not present.
   61:   $flag=0;
   62:   open(IN,'&lt;<TARGET />');
   63:   while (&lt;IN&gt;) { 
   64:     if (/^\s*Include\s+conf\/loncapa_apache.conf/) {
   65:       $flag=1; 
   66:     }
   67:   }
   68:   close(IN);
   69:   unless ($flag==1) {
   70:     open(OUT,'&gt;&gt;<TARGET />');
   71:     print(OUT 'Include conf/loncapa_apache.conf'."\n");
   72:     close(OUT);
   73:   }
   74:   # Remove loncapa.conf inclusion from httpd.conf if present.
   75:   $flag=0;
   76:   open(IN,'&lt;<TARGET />');
   77:   while (&lt;IN&gt;) {
   78:     if (/^\s*Include\s+conf\/loncapa.conf/) {
   79:       $flag=1;
   80:     }
   81:   }
   82:   close(IN);
   83:   $in='';
   84:   if ($flag==1) {
   85:     open(IN,'&lt;<TARGET />');
   86:     while(&lt;IN&gt;) {
   87:       $in.=$_ unless /^\s*Include\s+conf\/loncapa.conf/;
   88:     }
   89:     close(IN);
   90:     open(OUT,'&gt;<TARGET />');
   91:     print(OUT $in."\n");
   92:     close(OUT);
   93:   }
   94: }
   95: </perlscript>
   96: </file>
   97: <file>
   98: <target dist='default'>/etc/httpd/conf/httpd.conf</target>
   99: <note>This is always expected for any version of Apache</note>
  100: <dependencies dist='default'>
  101: /etc/httpd/conf/httpd.conf
  102: </dependencies>
  103: <perlscript mode='fg'>
  104: # Generated from doc/loncapafiles/webserver.piml
  105: # Trying to check for overlapping DocumentRoot or ScriptAlias definitions.
  106: unless (-e "<TARGET />") {
  107:   print '**** ERROR **** httpd.conf should exist! Are you missing the Apache '.
  108:     'software package?';
  109:   exit(1);
  110: }
  111: else {
  112:   # Append loncapa_apache.conf inclusion to httpd.conf if not present.
  113:   $scriptalias_flag=0;
  114:   $documentroot_flag=0;
  115:   my $scriptalias;
  116:   my $documentroot;
  117:   open(IN,'&lt;<TARGET />');
  118:   while (&lt;IN&gt;) { 
  119:     if (m!^\s*ScriptAlias\s+/cgi-bin/\s+(.*)$!) {
  120:       $scriptalias = $1;
  121:       if ($scriptalias !~ m!home/httpd/cgi-bin!) {
  122: 	$scriptalias_flag = 1;
  123:       }
  124:     }
  125:     if (m!^\s*DocumentRoot\s+(.*)$!) {
  126:       $documentroot = $1;
  127:       if ($documentroot !~ m!home/httpd/html!) {
  128: 	$documentroot_flag = 1;
  129:       }
  130:     }
  131:   }
  132:   close(IN);
  133:   if ($scriptalias_flag==1) {
  134:     print('**** ERROR **** httpd.conf has an overlapping definition of '.
  135:           'ScriptAlias (it is incorrectly set to '.$scriptalias.').'."\n".
  136: 	  'This conflicts with loncapa_apache.conf.'."\n");
  137:   }
  138:   if ($documentroot_flag==1) {
  139:     print('**** ERROR **** httpd.conf has an overlapping definition of '.
  140:           'DocumentRoot (it is incorrectly set to '.$documentroot.').'."\n".
  141: 	  'This conflicts with loncapa_apache.conf.'."\n");
  142:   }
  143:   if ($documentroot_flag==1 or $scriptalias_flag==1) {
  144:     exit(1);
  145:   }
  146: }
  147: </perlscript>
  148: </file>
  149: </files>
  150: </piml>

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