File get_module_list of Package apache2 (Revision 38)
Currently displaying revision 38, show latest
1
#!/bin/bash
2
3
pname=apache2
4
: ${sysconfdir:=/etc/$pname}
5
: ${sysconfig_apache:=/etc/sysconfig/$pname}
6
default_APACHE_DOCUMENT_ROOT=/srv/www/htdocs
7
8
test -z "$APACHE_MODULES" && . /usr/share/$pname/load_configuration
9
apache_bin=$(/usr/share/$pname/find_mpm 2>/dev/null)
10
APACHE_MPM=${apache_bin##*-}
11
if [ -z "$APACHE_MPM" ]; then
12
echo >&2 Warning: no MPM found. Some modules are dependant on the type of MPM.
13
fi
14
15
if [ "$1" = -q ]; then
16
quiet=true
17
else
18
quiet=false
19
fi
20
21
#echo -n writing sysconfig.d/loadmodule.conf
22
TMPFILE=`/bin/mktemp /tmp/$pname.XXXXXXXXXXXX`
23
if [ -z "$TMPFILE" ]; then
24
echo >&2 Error: could not create temporary file for writing loadmodules.conf.
25
exit 1
26
fi
27
28
exec 3>$TMPFILE
29
echo >&3 "#
30
# Files in this directory are created at apache start time by /usr/sbin/rc$pname
31
# Do not edit them!
32
#
33
34
# as listed in APACHE_MODULES ($sysconfig_apache)
35
"
36
test -z "$APACHE_MODULES" && APACHE_MODULES=$LOADMODULES
37
# see whether APACHE_MODULES is declared as array (it was so, in the past)
38
# if it is not an array, we convert it to one.
39
if [[ -z ${APACHE_MODULES[1]} ]]; then
40
# strip leading and trailing parens... since it might erroneously be written as
41
# APACHE_MODULES="(asdf 1234)"
42
APACHE_MODULES=${APACHE_MODULES/(}; APACHE_MODULES=${APACHE_MODULES/)}
43
APACHE_MODULES=($APACHE_MODULES)
44
fi
45
46
for i in ${APACHE_MODULES[*]}; do
47
unset module_path module_id
48
case $i in mod_cgid|cgid) case $APACHE_MPM in prefork|leader) i=${i%d};; esac;; esac
49
case $i in mod_cgi|cgi) case $APACHE_MPM in event|worker) i=${i}d;; esac;; esac
50
51
module_id=${i##*/}
52
module_id=${module_id#mod_}
53
module_id=${module_id#lib}
54
module_id=${module_id%.so}_module
55
56
# special case
57
case $module_id in auth_mysql_module) module_id=mysql_auth_module;; esac
58
59
case $i in
60
/*)
61
module_path=$i
62
;;
63
*)
64
for j in /usr/lib/$pname-$APACHE_MPM/mod_$i.so \
65
/usr/lib/$pname-$APACHE_MPM/$i.so \
66
/usr/lib/$pname-$APACHE_MPM/mod_$i \
67
/usr/lib/$pname-$APACHE_MPM/$i \
68
/usr/lib/$pname-$APACHE_MPM/${i/mod_}.so \
69
/usr/lib/$pname-$APACHE_MPM/${i/mod_} \
70
/usr/lib/$pname-$APACHE_MPM/lib${i/mod_}.so \
71
/usr/lib/$pname-$APACHE_MPM/lib${i/mod_} \
72
/usr/lib/$pname-$APACHE_MPM/lib$i.so \
73
/usr/lib/$pname-$APACHE_MPM/lib$i \
74
/usr/lib/$pname/mod_$i.so \
75
/usr/lib/$pname/$i.so \
76
/usr/lib/$pname/mod_$i \
77
/usr/lib/$pname/$i \
78
/usr/lib/$pname/${i/mod_}.so \
79
/usr/lib/$pname/${i/mod_} \
80
/usr/lib/$pname/lib${i/mod_}.so \
81
/usr/lib/$pname/lib${i/mod_} \
82
/usr/lib/$pname/lib$i.so \
83
/usr/lib/$pname/lib$i
84
do
85
if [ -f $j ]; then
86
module_path=$j
87
break
88
fi
89
done
90
;;
91
esac
92
93
if [[ -f $module_path ]]; then
94
printf "LoadModule %-30s %s\n" $module_id $module_path >&3
95
else
96
# print a warning?
97
# php modules are in the list by default, so we don't warn about it [#66729]
98
if ! $quiet && [ $i != "php4" -a $i != "php5" ]; then
99
echo >&2 "Module \"$i\" is not installed, ignoring."
100
echo >&2 "Check the APACHE_MODULES setting in /etc/sysconfig/$pname."
101
fi
102
103
fi
104
done
105
echo >&3 -e "#\n"
106
exec 3<&-
107
chmod 644 $TMPFILE
108
mv $TMPFILE $sysconfdir/sysconfig.d/loadmodule.conf
109
#echo -n ". "
110
111
112
#echo -n writing sysconfig.d/global.conf
113
exec 3>$sysconfdir/sysconfig.d/global.conf
114
echo >&3 "#
115
# Files in this directory are created at apache start time by /usr/sbin/rc$pname
116
# Do not edit them!
117
#
118
119
# see $sysconfig_apache
120
"
121
122
if [[ -n $APACHE_DOCUMENT_ROOT ]]; then
123
echo >&3 "DocumentRoot $APACHE_DOCUMENT_ROOT"
124
# else
125
# if ! grep -q "^DocumentRoot" $sysconfdir/httpd.conf 2>/dev/null; then
126
# echo >&3 "DocumentRoot $default_APACHE_DOCUMENT_ROOT"
127
# fi
128
fi
129
130
[[ -n $APACHE_TIMEOUT ]] && echo >&3 "Timeout $APACHE_TIMEOUT"
131
if [[ -n $APACHE_SERVERSIGNATURE ]]; then
132
case $APACHE_SERVERSIGNATURE in
133
no) APACHE_SERVERSIGNATURE=off;;
134
yes) APACHE_SERVERSIGNATURE=on;;
135
esac
136
echo >&3 "ServerSignature $APACHE_SERVERSIGNATURE"
137
fi
138
[[ -n $APACHE_SERVERADMIN ]] && echo >&3 "ServerAdmin $APACHE_SERVERADMIN"
139
[[ -n $APACHE_SERVERNAME ]] && echo >&3 "ServerName $APACHE_SERVERNAME"
140
[[ -n $APACHE_USE_CANONICAL_NAME ]] && echo >&3 "UseCanonicalName $APACHE_USE_CANONICAL_NAME"
141
[[ -n $APACHE_SERVERTOKENS ]] && echo >&3 "ServerTokens $APACHE_SERVERTOKENS"
142
[[ $APACHE_EXTENDED_STATUS = on ]] && echo -e >&3 "<IfModule mod_status.c>\n ExtendedStatus on\n</IfModule>"
143
[[ $APACHE_BUFFERED_LOGS = on ]] && echo >&3 "BufferedLogs on"
144
[[ -n $APACHE_LOGLEVEL ]] && echo >&3 "LogLevel $APACHE_LOGLEVEL"
145
if [[ -n $APACHE_ACCESS_LOG ]]; then
146
# split multiple entries
147
APACHE_ACCESS_LOG=($APACHE_ACCESS_LOG)
148
for ((i=0; $i<${#APACHE_ACCESS_LOG[*]}; i=i+2)); do
149
filename=${APACHE_ACCESS_LOG[$i]}
150
format=${APACHE_ACCESS_LOG[$i+1]}
151
echo >&3 "CustomLog $filename ${format/%,}"
152
done
153
fi
154
155
156
exec 3<&-
157
#echo -n ". "
158
159