summaryrefslogtreecommitdiff
path: root/debian/a2-scripts/a2dismod
blob: 0986b3a88b7a4a827790fd8a13fb092d15da844b (plain)
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
#!/bin/sh -e

SYSCONFDIR='/etc/apache2'

if [ -z $1 ]; then
	echo "Which module would you like to disable?"
	echo -n "Your choices are: "
	ls $SYSCONFDIR/mods-enabled/*.load | \
	sed -e "s,$SYSCONFDIR/mods-enabled/,,g" | sed -e 's/\.load$//g;' | xargs echo
	echo -n "Module name? "
	read MODNAME
else
	MODNAME=$1
fi

DEPENDS=`grep -l "# Depends:.*$MODNAME" $SYSCONFDIR/mods-enabled/*.load| sed -e "s,$SYSCONFDIR/mods-enabled/,,g" | sed -e 's/\.load$//g;'`
#for i in $DEPENDS; do
#        a2dismod ${i%.load};
#done
if [ ! -z "$DEPENDS" ]; then
        echo "The following modules depend on the module you requested be uninstalled:" >&2
        echo "$DEPENDS" >&2
        echo "Please uninstall these first" >&2
        exit 1
fi

if ! [ -L $SYSCONFDIR/mods-enabled/$MODNAME.load ]; then
    if [ -e $SYSCONFDIR/mods-available/$MODNAME.load ]; then
        echo "Module $MODNAME already disabled"
        exit 0
    fi
    echo "Module $MODNAME does not exist!" >&2
    exit 1
fi

rm -f $SYSCONFDIR/mods-enabled/$MODNAME.*
echo "Module $MODNAME disabled; run /etc/init.d/apache2 force-reload to fully disable."