#!/bin/sh -e

SYSCONFDIR='/etc/httpd2/conf'

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

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

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