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

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: 
1.30    ! raeburn     5: <!-- $Id: webserver.piml,v 1.29 2010/01/01 04:29:01 raeburn Exp $ -->
1.1       harris41    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>
1.6       harris41   40: <targetroot>/</targetroot>
1.2       harris41   41: <specialnotices>
                     42: <specialnotice>
                     43: </specialnotice>
                     44: </specialnotices>
1.1       harris41   45: <files>
                     46: <file>
                     47: <target dist='default'>/etc/httpd/conf/httpd.conf</target>
1.20      raeburn    48: <target dist='suse9.2 suse9.3 sles9'>/etc/httpd/httpd.conf</target>
1.30    ! raeburn    49: <target dist='sles10 sles11 suse10.1 suse10.2 suse10.3 suse11.1 suse11.2 suse11.3'>/etc/apache2/default-server.conf</target>
1.27      raeburn    50: <target dist='debian5 ubuntu6 ubuntu8'>/etc/apache2/sites-available/loncapa</target>
1.25      raeburn    51: <note>This is for Apache 1.X for Red Hat, Fedora 2,3 and 4, and SusSE 9.2, 9.3 and SLES 9 distributions. This is for Apache 2.X for Fedora 5 and later, and SuSE 10.X, 11.X and SLES 10 distributions, and Debian 5, Ubuntu 6 and Ubuntu 8 LTS distributions</note>
1.1       harris41   52: <dependencies dist='default'>
                     53: /etc/httpd/conf/httpd.conf
                     54: </dependencies>
1.20      raeburn    55: <dependencies dist='suse9.2 suse9.3 sles9'>
                     56: /etc/httpd/httpd.conf
                     57: </dependencies>
1.25      raeburn    58: <dependencies dist='debian5 ubuntu6 ubuntu8'>
                     59: /etc/apache2/sites-available/loncapa
                     60: </dependencies>
1.30    ! raeburn    61: <dependencies dist='sles10 sles11 suse10.1 suse10.2 suse10.3 suse11.1 suse11.2 suse11.3'>
1.20      raeburn    62: /etc/apache2/default-server.conf
                     63: </dependencies>
1.19      raeburn    64: <perlscript mode='fg' dist="default">
1.11      harris41   65: # Generated from doc/loncapafiles/webserver.piml
1.1       harris41   66: unless (-e "<TARGET />") {
1.20      raeburn    67:   print '**** ERROR! <TARGET /> should exist! Are you missing the Apache '.
1.13      harris41   68:     'software package?';
1.11      harris41   69:   exit(1);
1.1       harris41   70: }
                     71: else {
1.25      raeburn    72:   # Append loncapa_apache.conf inclusion to httpd.conf (or sites/available/loncapa) if not present.
1.9       harris41   73:   $flag=0;
1.11      harris41   74:   open(IN,'&lt;<TARGET />');
1.9       harris41   75:   while (&lt;IN&gt;) { 
                     76:     if (/^\s*Include\s+conf\/loncapa_apache.conf/) {
                     77:       $flag=1; 
                     78:     }
                     79:   }
1.11      harris41   80:   close(IN);
1.9       harris41   81:   unless ($flag==1) {
1.11      harris41   82:     open(OUT,'&gt;&gt;<TARGET />');
                     83:     print(OUT 'Include conf/loncapa_apache.conf'."\n");
                     84:     close(OUT);
1.9       harris41   85:   }
1.12      harris41   86:   # Remove loncapa.conf inclusion from httpd.conf if present.
1.11      harris41   87:   $flag=0;
                     88:   open(IN,'&lt;<TARGET />');
                     89:   while (&lt;IN&gt;) {
                     90:     if (/^\s*Include\s+conf\/loncapa.conf/) {
                     91:       $flag=1;
                     92:     }
                     93:   }
                     94:   close(IN);
                     95:   $in='';
                     96:   if ($flag==1) {
                     97:     open(IN,'&lt;<TARGET />');
                     98:     while(&lt;IN&gt;) {
                     99:       $in.=$_ unless /^\s*Include\s+conf\/loncapa.conf/;
                    100:     }
                    101:     close(IN);
                    102:     open(OUT,'&gt;<TARGET />');
                    103:     print(OUT $in."\n");
                    104:     close(OUT);
1.13      harris41  105:   }
1.18      raeburn   106: 
                    107: # Checking for overlapping ScriptAlias and DocumentRoot definitions.
                    108:   $scriptalias_flag=0;
                    109:   $documentroot_flag=0;
                    110:   my $scriptalias;
                    111:   my $documentroot;
                    112:   open(IN,'&lt;<TARGET />');
                    113:   while (&lt;IN&gt;) {
                    114:     if (m!^\s*ScriptAlias\s+/cgi-bin/\s+(.*)$!) {
                    115:       $scriptalias = $1;
                    116:       if ($scriptalias !~ m!home/httpd/cgi-bin!) {
                    117:         $scriptalias_flag = 1;
                    118:       }
                    119:     }
                    120:     if (m!^\s*DocumentRoot\s+(.*)$!) {
                    121:       $documentroot = $1;
                    122:       if ($documentroot !~ m!home/httpd/html!) {
                    123:         $documentroot_flag = 1;
                    124:       }
                    125:     }
                    126:   }
                    127:   close(IN);
                    128:   if ($scriptalias_flag==1) {
                    129:     print('**** ERROR **** /etc/httpd/conf/httpd.conf has an overlapping definition of '.
                    130:           'ScriptAlias (it is incorrectly set to '.$scriptalias.').'."\n".
                    131:           'This conflicts with loncapa_apache.conf.'."\n");
                    132:   }
                    133:   if ($documentroot_flag==1) {
                    134:     print('**** ERROR **** /etc/httpd/conf/httpd.conf has an overlapping definition of '.
                    135:           'DocumentRoot (it is incorrectly set to '.$documentroot.').'."\n".
                    136:           'This conflicts with loncapa_apache.conf.'."\n");
                    137:   }
1.13      harris41  138: }
                    139: </perlscript>
1.1       harris41  140: </file>
                    141: </files>
                    142: </piml>

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