#!/bin/sh


case "$1" in
	configure)
		### Begin Configure ###

		F1=/etc/webmin/config
		if [ -f "$F1" ]; then
			echo "Enabling SGA Theme"
			grep -q '^theme=' "$F1" && sed -i.bak -e 's/^theme=.*/theme=sg-theme/' "$F1" || echo 'theme=sg-theme' >>"$F1"
		fi

		F2=/etc/webmin/miniserv.conf
		if [ -f "$F2" ]; then
			echo "Enabling SGA MiniServ Theme"
			grep -q '^preroot=' "$F2" && sed -i.bak -e 's/^preroot=.*/preroot=sg-theme/' "$F2" || echo 'theme=sg-theme' >>"$F2"
		fi

		echo "Restarting SGA Web interface ..."
		invoke-rc.d webmin stop 
		invoke-rc.d webmin start

		### End Configure ###
	;;
	abort-upgrade|abort-remove|abort-deconfigure)
	;;
	*)
		echo "postinst called with unknown argument \`$1'" >&2
		exit 1
	;;
esac
exit 0
