File a2enmod of Package apache2
1
#!/bin/bash
2
3
# Copyright 2005 Peter Poeml <apache@suse.de>. All Rights Reserved.
4
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
9
10
11
sysconf=/etc/sysconfig/apache2
12
var=APACHE_MODULES
13
PATH="$PATH:/usr/bin:/usr/sbin:/usr/share/apache2"
14
15
debug=true
16
17
function usage() {
18
echo "$(basename $0): enable/disable an apache module in $var in $sysconf"
19
echo
20
echo "usage: $(basename $0) [-d] module"
21
echo " $(basename $0) -l list modules"
22
echo " $(basename $0) -q module query if module is installed"
23
#echo " $(basename $0) -h runtests"
24
exit 1
25
}
26
27
if [ $# -lt 1 ]; then
28
usage
29
fi
30
31
action=enable
32
case "$1" in
33
-d) action=disable; shift;;
34
-l) action=list; shift;;
35
-q) action=query; shift;;
36
-*) usage;;
37
esac
38
39
case $(basename $0) in
40
a2dismod) action=disable;;
41
esac
42
43
mod=$1
44
45
46
if [ $action = enable ]; then
47
sysconf_addword $sysconf $var $mod
48
exit $?
49
elif [ $action = disable ]; then
50
sysconf_addword -r $sysconf $var $mod
51
exit $?
52
elif [ $action = query ]; then
53
if a2enmod -l | grep -q "\<$mod\>"; then
54
exit 0
55
else
56
exit 1
57
fi
58
else
59
source $sysconf
60
eval echo \$$var
61
fi
62
63