# Copyright 30 Jan 1996 Sun Microsystems, Inc. All Rights Reserved.
#
#pragma ident  "@(#)preremove	1.2 96/02/02 Sun Microsystems"
#
# preremove script for Openstep Removable Media Support Installation.
#
# Return pid of named process in variable "pid"
#
# Exit codes for installation scripts
 
export BASEDIR
 
e_ok=0
e_fatal=1      # stop installation on this exit
e_warning=2    # Installation will go on.
e_int=3        # Interrupted. Stop installation
e_reboot=10    # User must reboot after installation of all selected packages
e_rebootnow=20 # User must reboot right after installation of current package
               # To be added to one of the single-digit exit codes above
 
#
# Trap interrupt
#
trap `exit $e_int` 15
#
 
#
#	Check to see if action_workspace.so.1 already exists and remove
#	it if it does.
#
pkginfo -q $PKGINST
if [ $? -eq 0 ]; then
	if [ -f /usr/lib/rmmount/action_workspace.so.1 ]; then
		rm -rf /usr/lib/rmmount/action_workspace.so.1
	fi
fi
 
#
#	Check to see if the action_workspace.so lines are in the
#	/etc/rmmount.conf file, and if so, remove them.
#
FILE=/etc/rmmount.conf

if [ ! -w $FILE ]; then
	echo need superuser access
	exit $e_fatal
fi

egrep -s action_workspace.so $FILE
if [ $? -ne 0 ]; then
#	Assume the lines aren't there.
        exit $e_ok
fi

ed $FILE << EOF > /dev/null
g/^# allow volume management under OpenStep/d
g/^action cdrom action_workspace.so/d
g/^action floppy action_workspace.so/d
w
q
EOF

exit $e_ok
 

