2006-12-20 18:01:15 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2007-03-20 01:13:36 +01:00
|
|
|
# Copyright 2005 Peter Poeml <apache@suse.de>. All Rights Reserved.
|
2006-12-20 18:01:15 +01:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
|
|
function usage() {
|
2015-07-14 11:04:22 +02:00
|
|
|
echo "$(basename $0): enable/disable an apache module in $var in $sysconf"
|
|
|
|
echo
|
2006-12-20 18:01:15 +01:00
|
|
|
echo "usage: $(basename $0) [-d] module"
|
|
|
|
echo " $(basename $0) -l list modules"
|
|
|
|
echo " $(basename $0) -q module query if module is installed"
|
2015-07-14 11:04:22 +02:00
|
|
|
echo
|
|
|
|
echo "HTTPD_INSTANCE=<instance_name> environment variable can be used to specify"
|
|
|
|
echo "apache instance (see README-instances.txt); sysconfig file is expected"
|
|
|
|
echo "at /etc/sysconfig/apache2@<instance_name> ."
|
2006-12-20 18:01:15 +01:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2015-07-14 11:04:22 +02:00
|
|
|
unset instance_suffix
|
|
|
|
if [ -n "$HTTPD_INSTANCE" ]; then
|
|
|
|
instance_suffix="@$HTTPD_INSTANCE"
|
|
|
|
fi
|
|
|
|
|
|
|
|
sysconf=/etc/sysconfig/apache2$instance_suffix
|
|
|
|
var=APACHE_MODULES
|
|
|
|
PATH="$PATH:/usr/bin:/usr/sbin:/usr/share/apache2"
|
|
|
|
|
2006-12-20 18:01:15 +01:00
|
|
|
if [ $# -lt 1 ]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
|
|
|
action=enable
|
|
|
|
case "$1" in
|
|
|
|
-d) action=disable; shift;;
|
|
|
|
-l) action=list; shift;;
|
|
|
|
-q) action=query; shift;;
|
|
|
|
-*) usage;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $(basename $0) in
|
|
|
|
a2dismod) action=disable;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
mod=$1
|
|
|
|
|
|
|
|
|
|
|
|
if [ $action = enable ]; then
|
|
|
|
sysconf_addword $sysconf $var $mod
|
|
|
|
exit $?
|
|
|
|
elif [ $action = disable ]; then
|
|
|
|
sysconf_addword -r $sysconf $var $mod
|
|
|
|
exit $?
|
|
|
|
elif [ $action = query ]; then
|
|
|
|
if a2enmod -l | grep -q "\<$mod\>"; then
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
source $sysconf
|
|
|
|
eval echo \$$var
|
|
|
|
fi
|
|
|
|
|