#!/bin/sh
#
# De-installation setup of ravcore

PREFIX="/usr/local"
ETC_PATH="${PREFIX}/etc/rav"
CONFIG_FILE="${PREFIX}/etc/rav/rup.conf"

# Function: delete ravms user account.
#
do_accts()
{
	echo ""
	echo "| Delete the 'ravms' user/group account manually for"
	echo "| a full de-installation. To do this execute as root:"
	echo "| pw groupdel ravms"
	echo "| pw userdel ravms"
}

# Function: delete the configuration file
#
do_config()
{
	echo ""
	echo "| The ravupdate configuration file"
	echo "| ${CONFIG_FILE}"
	echo "| has not been deleted. To do this execute as root:"
	echo "| rm -f ${CONFIG_FILE}"
	echo "| rm -f ${ETC_PATH}"
}

# verify proper execution
#
if [ $# -ne 2 ]; then
	echo "usage: $0 distname { DEINSTALL | POST-DEINSTALL }" >&2
	exit 1
fi

# Verify/process the command
#
case $2 in
	DEINSTALL)
	do_accts
	;;
	POST-DEINSTALL)
	do_config
	;;
	*)
	echo "Usage: `basename $0` distname DEINSTALL | POST-DEINSTALL" >&2
	exit 1
	;;
esac

exit 0
