#!/bin/sh -e

SYSCONFDIR='/etc/httpd2/conf'

if [ -z "$1" ]; then
	echo "Which extra config would you like to disable?"
	echo -n "Your choices are: "
	ls $SYSCONFDIR/extra-enabled/*.conf | \
	sed -e "s,$SYSCONFDIR/extra-enabled/\(.*\).conf,\1,g" | xargs echo
	echo -n "Extra config name? "
	read CONFNAME
else
	CONFNAME=$1
fi

if ! [ -e "$SYSCONFDIR/extra-enabled/$CONFNAME.conf" ]; then
	echo "Extra config $CONFNAME.conf is already disabled, or does not exist!"
	exit 1
fi

rm "$SYSCONFDIR/extra-enabled/$CONFNAME.conf" 2>/dev/null
echo "Extra config $CONFNAME disabled;"
echo "	run service httpd2 condreload to fully disable."
