home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # Copyright 2001 David Cantrell, Concord, California USA
- # All rights reserved.
- #
- # Redistribution and use of this script, with or without modification, is
- # permitted provided that the following conditions are met:
- #
- # 1. Redistributions of this script must retain the above copyright
- # notice, this list of conditions and the following disclaimer.
- #
- # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
- # ChangeLog:
- # 09-Mar-2001 The module description is now obtained from the script
- # in /var/log/setup/apache.
- #
- # 26-Feb-2001 Initial version.
- #
-
- # Check to make sure that needed Apache components exist
- if [ ! -d /var/log/setup/apache ]; then
- exit
- fi
- if [ "`( cd /var/log/setup/apache ; /bin/ls -1 )`" = "" ]; then
- exit
- fi
- if [ ! -d /etc/apache ]; then
- exit
- fi
- if [ "`( cd /etc/apache ; /bin/ls -1 )`" = "" ]; then
- exit
- fi
-
- if [ ! "$USER" = "root" ]; then
- exit
- fi
-
- # Set some initial variables and locations
- TMP=/var/log/setup/tmp
- if [ ! -d $TMP ]; then
- mkdir -p $TMP
- chmod 700 $TMP
- fi
-
- # Generate the dialog script
- rm -rf $TMP/apachescript.sh
- cat << EOF > $TMP/apachescript.sh
- #!/bin/sh
- dialog --title "APACHE WEB SERVER CONFIGURATION" --menu \\
- "The following lists contains settings and/or modules for \\
- the Apache web server. Select the one you would like to \\
- configure and press Enter." 13 60 4 \\
- EOF
-
- # Add the modules to the menu
- for mod in `( cd /var/log/setup/apache ; /bin/ls -1 | sort )` ; do
- moddesc="`cat /var/log/setup/apache/$mod | grep "# DESCRIPTION: " | sed -e "s|# DESCRIPTION: ||g"`"
-
- if [ "$moddesc" = "" ]; then
- echo "\"$mod\" \"$mod\" \\" >> $TMP/apachescript.sh
- else
- echo "\"$mod\" \"$moddesc\" \\" >> $TMP/apachescript.sh
- fi
- done
-
- # Complete the script
- cat << EOF >> $TMP/apachescript.sh
- 2> $TMP/output
- if [ \$? = 1 -o \$? = 255 ]; then
- rm -f $TMP/output
- exit
- fi
- EOF
-
- sh $TMP/apachescript.sh
-
- if [ ! -r $TMP/output ]; then
- rm -f $TMP/apachescript.sh
- exit
- fi
-
- OUTPUT=`cat $TMP/output`
-
- # Configure this Apache module/setting
- if [ -x /var/log/setup/apache/$OUTPUT ]; then
- sh /var/log/setup/apache/$OUTPUT
- fi
-
- rm -f $TMP/apachescript.sh $TMP/output
-
-