#! /sbin/sh
####################################################################
#	$Id: preremove,v 1.3 2000/08/21 23:16:48 jamesp Exp $
# 	Copyright (c) Digi, Digi International Inc.
#
#	Pre-removal script for Digi AccelePort Driver.
#	Copyright (c) 1988-2000 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 "dgdxb" 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 != "dgdxb" ) { 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/dgdxb.a

exit 0
