#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident	"@(#)postremove	1.1	04/11/11 SMI"
#
# preremove script.  
# This is similar to the script provided in the Webmin package except
# it uses the SFW paths, and defines them as environment variables.
#

base_dir=$PKG_INSTALL_ROOT/usr/sfw/lib/webmin
config_dir=$PKG_INSTALL_ROOT/etc/webmin
var_dir=$PKG_INSTALL_ROOT/var/webmin

#
# Should already be stopped, but no harm in trying again.
#
if [ -x ${config_dir}/stop ];then
	${config_dir}/stop
fi
grep root=${base_dir} ${config_dir}/miniserv.conf >/dev/null 2>&1
if [ "$?" = 0 -a "$KEEP_ETC_WEBMIN" = "" ]; then
	# Package is being removed, and no new version of webmin
	# has taken it's place. Delete the config files
	rm -rf ${config_dir} ${var_dir}
fi

exit 0
