2015-07-13 10:18:58 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
HTTPD_SBIN_BASE="/usr/sbin/httpd"
|
|
|
|
|
|
|
|
#
|
|
|
|
# loads sysconfig variables into environment
|
|
|
|
#
|
|
|
|
# return value in: APACHE_*
|
|
|
|
#
|
|
|
|
function load_sysconfig
|
|
|
|
{
|
|
|
|
[ -n "$sysconfig_loaded" ] && return
|
2020-11-26 14:18:20 +01:00
|
|
|
[ ! -f "$HTTPD_SYSCONFIG_FILE" ] && return
|
2015-07-13 10:18:58 +02:00
|
|
|
|
2020-11-26 14:18:20 +01:00
|
|
|
. $HTTPD_SYSCONFIG_FILE
|
2015-07-13 10:18:58 +02:00
|
|
|
|
|
|
|
export ${!APACHE_*} sysconfig_loaded=true
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# finds prefered multiprocessing module
|
|
|
|
#
|
|
|
|
# return value in: HTTPD_MPM
|
|
|
|
#
|
|
|
|
|
|
|
|
function find_mpm
|
|
|
|
{
|
2018-09-27 13:14:35 +02:00
|
|
|
# load sysconfig variables if they weren't yet;
|
|
|
|
# this has no effect when find_mpm is not called
|
|
|
|
# from start_apache2
|
2015-07-13 10:18:58 +02:00
|
|
|
load_sysconfig
|
|
|
|
|
|
|
|
# try to read from sysconfig's APACHE_MPM
|
2018-09-27 13:14:35 +02:00
|
|
|
HTTPD_MPM="$APACHE_MPM"
|
2020-11-26 14:18:20 +01:00
|
|
|
# if empty, then choose the one chosen by
|
|
|
|
# update alternatives
|
2015-07-13 10:18:58 +02:00
|
|
|
if [ -z "$HTTPD_MPM" ]; then
|
2020-11-26 14:18:20 +01:00
|
|
|
HTTPD_MPM=$(readlink $(readlink /usr/sbin/httpd) | sed "s:/usr/sbin/httpd-::")
|
2015-07-13 10:18:58 +02:00
|
|
|
fi
|
|
|
|
|
2018-09-27 13:14:35 +02:00
|
|
|
# in case no
|
|
|
|
export HTTPD_MPM
|
2015-07-13 10:18:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# search for paths for wanted modules (declared in
|
|
|
|
# APACHE_MODULES)
|
|
|
|
#
|
|
|
|
# return value in: HTTPD_MODULE_IDS
|
|
|
|
# HTTPD_MODULE_PATHS
|
|
|
|
#
|
|
|
|
|
|
|
|
function get_module_list
|
|
|
|
{
|
|
|
|
load_sysconfig
|
|
|
|
find_mpm
|
|
|
|
|
|
|
|
for module in $APACHE_MODULES; do
|
|
|
|
# special case
|
|
|
|
# remove or add 'd' on in cgi module name
|
|
|
|
case $module in mod_cgid|cgid)
|
|
|
|
case $HTTPD_MPM in prefork) module=${module%d};; esac;;
|
|
|
|
esac
|
|
|
|
case $module in mod_cgi|cgi)
|
|
|
|
case $HTTPD_MPM in event|worker) module=${module}d;; esac;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
module_id=${module#mod_}_module
|
|
|
|
|
2021-01-08 16:12:03 +01:00
|
|
|
# special cases
|
2015-07-13 10:18:58 +02:00
|
|
|
case $module_id in auth_mysql_module) module_id=mysql_auth_module;; esac
|
2021-01-08 16:12:03 +01:00
|
|
|
case $module_id in php[89]_module) module_id=php_module;; esac
|
2015-07-13 10:18:58 +02:00
|
|
|
|
|
|
|
unset module_path
|
|
|
|
for libdir in /usr/lib64 /usr/lib; do
|
|
|
|
for filepath in $libdir/apache2-$HTTPD_MPM/mod_$module.so \
|
|
|
|
$libdir/apache2-$HTTPD_MPM/$module.so \
|
|
|
|
$libdir/apache2/mod_$module.so \
|
|
|
|
$libdir/apache2/$module.so; do
|
|
|
|
if [ -f $filepath ]; then
|
|
|
|
module_path=$filepath
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "$module_path" ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "$module_path" ]; then
|
|
|
|
HTTPD_MODULE_IDS="$HTTPD_MODULE_IDS $module_id"
|
|
|
|
HTTPD_MODULE_PATHS="$HTTPD_MODULE_PATHS $module_path"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
export HTTPD_MODULE_IDS
|
|
|
|
export HTTPD_MODULE_PATHS
|
|
|
|
}
|
|
|
|
|