#!/bin/sh

#	removeit2
#
#	Derived from:	Template supplied by SGI for hot mix installation
#
#	Author:		Anthony Shaughnessy
#
#	Created on:	15th June 1993
#
#	Sccs ID:	@(#)removeit2.sh	1.3 7/26/93
#
#	Coding Stds.:	2.0
#
#	Purpose:	To remove SoftPC. This script is called from RemoveIt
#			and is run in a window as root. It uses the
#			versions remove command to remove SoftPC after
#			accepting confirmation from the user that they actually
#			want to remove SoftPC
#

# Get a yes or no answer and no other. The program will loop until a valid
# answer is input. Acceptable values are y, n, yes, or no, in any mix of case.
# The answer is returned in $ANSWER, as either yes or no.
getyesno(){
while read ANSWER
do
	ANSWER=`echo $ANSWER | tr '[A-Z]' '[a-z]'`
	case $ANSWER in
	y|yes)
		ANSWER=yes
		break
		;;
	n|no)
		ANSWER=no
		break
		;;

	*)
			echo "You must answer yes or no : \c"
	esac
done
}

# Exit this script, displaying the message held in $1, and asking the user to
# press return before closing the window.
exit_wrapper(){
	echo "\n$1"
	echo "\nPress enter to exit this window...\c "
	read ans
	exit
}


echo "\nDo you want to remove the SoftPC package? (y/n) : \c"

getyesno

test $ANSWER = no && {
	exit_wrapper "SoftPC will not be removed"
}


echo "\nRemoving SoftPC - this may take a few minutes\n"

versions remove softpc > /dev/null 2>&1

exit_wrapper "SoftPC has been removed"
