#!/bin/sh
# @(#)preinstall.sh	1.4 revision of 97/06/16  21:56:13
# This is an unpublished work copyright (c) 1997 HELIOS Software GmbH
# 30159 Hannover, Germany

if test $# -ne 1
then
	echo "Usage: $0 path_to_install_dir" >&2
	exit 1
fi
ESDIR="$1"

# In case they made the EtherShare installation directory a volume...

$ESDIR/etc/rmtrash $ESDIR
rm -rf $ESDIR/.rsrc $ESDIR/.Desktop

rm -f $ESDIR/macapps/"ES Admin u0009"
rm -f $ESDIR/macapps/.rsrc/"ES Admin u0009"
rm -f $ESDIR/macapps/"ES Admin u0014"
rm -f $ESDIR/macapps/.rsrc/"ES Admin u0014"
rm -f $ESDIR/macapps/touch
rm -f $ESDIR/macapps/.rsrc/touch
rm -f $ESDIR/macapps/Tagger
rm -f $ESDIR/macapps/.rsrc/Tagger
rm -f $ESDIR/macapps/"OPI Setup"
rm -f $ESDIR/macapps/.rsrc/"OPI Setup"
rm -f $ESDIR/macapps/Unsupported/Lan[Tt]est
rm -f $ESDIR/macapps/Unsupported/.rsrc/Lan[Tt]est
rm -f $ESDIR/macapps/.Desktop

# Remove OPI programs, OPI must be installed after EtherShare
# anyways.

for i in opisrv layout hirespath oiinfo oiimginfo oictable etc/prefdump \
	etc/prefrestore etc/prefvalue Manifest.base OPIREADME README.hirespath \
	etc/OpenImagePreferences etc/!iccinfo.oic etc/!opiinfo.oif \
	etc/!signat.oif OpenImage/Plug-ins/opibase.so \
	OpenImage/Plug-ins/opiicc.so OpenImage/Plug-ins/signature.so \
	OpenImage/Plug-ins/spots.so OpenImage/Plug-ins/compress.so \
	OpenImage/Plug-ins/colortune.so
do
	rm -f $ESDIR/$i
done

# OPI saves overwritten files under the suffix .noopi on the first install
# and .bak on subsequent installs. Remove these as well.

find $ESDIR/ -name '*.noopi' -print |xargs rm -f >/dev/null 2>&1
find $ESDIR/ -name '*.bak' -print |xargs rm -f >/dev/null 2>&1
