#! /sbin/sh
####################################################################
#	$Id: preremove,v 1.4 2002/03/04 17:00:01 scottk Exp $
# 	Copyright (c) Digi, Digi International Inc.
#
#	Pre-removal script for Digi RealPort Driver.
#	Copyright (c) 1988-98 Digi International Inc.
#
#	For HP-UX 10.X & 11.X
#
#	NOTE: It is expected that the swinstall program will call
#             this script just before removing the files.
#				
####################################################################

PATH=$SW_PATH
export PATH

#
# Remove "drp" from the system file.
#
if [[ ! -f $SW_SYSTEM_FILE_PATH ]]
then
	echo "ERROR:   Couldn't find the system file."
	exit 1
fi

cat $SW_SYSTEM_FILE_PATH | \
	awk '( $0 != "drp" ) { print $0 }' > \
	${SW_SYSTEM_FILE_PATH}.new.tmp.digi

if [[ ! -f ${SW_SYSTEM_FILE_PATH}.new.tmp.digi ]]
then
	echo "ERROR:   Couldn't create new system file."
	exit 1
fi

cp ${SW_SYSTEM_FILE_PATH}.new.tmp.digi ${SW_SYSTEM_FILE_PATH}
if [[ $? -ne 0 ]]
then
	echo "ERROR:   Couldn't replace system file."
	exit 1
fi

rm -f ${SW_SYSTEM_FILE_PATH}.new.tmp.digi

#
# Remove the OS version specific binaries
#
rm -f /usr/conf/lib/drp.a
rm -f /usr/bin/ditty
rm -f /usr/local/bin/dinc
rm -f /sbin/drpd
rm -f /sbin/dgipserv
rm -f /sbin/dgelreset

exit 0
