Annotation of doc/loncapafiles/webserver.piml, revision 1.13

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

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