1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#!/bin/sh
set -e
for bin in /usr/sbin/apache /usr/sbin/apache-ssl /usr/sbin/httpd
do
echo "$bin"
if test -e "$bin"
then
apachepath="$bin"
fi
done
if [ -z "$apachepath" ]
then
echo "Could not find Apache..."
else
echo "Apache found at $apachepath."
#Configuring apache, after locating its conf file.
myconfpath=`$apachepath -V | sed -n "s/ \-D SERVER\_CONFIG\_FILE\=\"\(.*\)\"/\1/p"`
if [ -n "$myconfpath" ]
then
echo "Apache says your conf file is at $myconfpath"
fi
fi
if [ -z "$myconfpath" ]
then
#Hmm, can't find the apache binary? We can also try this:
for i in /etc/apache/conf /etc/apache-ssl/conf /etc/httpd/conf /etc/apache /etc/apache-ssl /etc/httpd
do
if test -e "$i/httpd.conf"
then
echo "Found a conf file at: $i/httpd.conf"
myconfpath="$i/httpd.conf"
fi
done
fi
if [ -z "$myconfpath" ]
then
echo ""
echo "We couldn't find your httpd.conf file installed. Is Apache properly configured?"
echo "You may wish to add: "
echo " Include /etc/slash/apache.conf"
echo "to your httpd.conf once it is setup properly."
echo ""
fi
if ! $(grep -q '^Include /etc/slash/apache.conf' $myconfpath)
then
echo -n 'In order for the slash code to function properly, we must include the directives of slash in your actual apache config file. Do you want me
to do it for you now ? [Y/n] '
read response
case "$response" in
[yY]* | '' )
cp $myconfpath $myconfpath.slashbkp
echo "Your original apache config file $myconfpath as been saved as $myconfpath.slashbkp"
echo "#Automatically added by slash for debian setup" >> $myconfpath
echo 'Include /etc/slash/apache.conf' >> $myconfpath
echo "" >> $myconfpath
;;
* )
echo 'OK, skipping the inclusion of slash.conf.'
echo "You may wish to add: "
echo " Include /etc/slash/apache.conf"
echo "to your httpd.conf by hand."
;;
esac
fi
|