#!/bin/sh
# @(#)uninstall.cpp	1.26 revision of 97/09/10  15:58:05
# This is an unpublished work copyright (c) 1989 HELIOS Software GmbH
# 30159 Hannover, Germany

set +vx

ESDIR=/usr/local/es
export ESDIR

# @(#)HeliosVersion 2.5.0a2 Copyright 1989-1998 HELIOS Software Garbsen

# @(#)setup.cpp	1.28 revision of 98/02/09  19:27:44
PATH=$ESDIR:$ESDIR/etc:$PATH
export PATH
grop="macusers"
user="macuser"
hostupper=`hostname|sed 's/\..*//'|tr '[a-z]' '[A-Z]'` 2>/dev/null
if test -z "$hostupper"
then
	hostupper=`uname -n|sed 's/\..*//'|tr '[a-z]' '[A-Z]'`
fi
hostid=`machid`
# test how we can suppress the new line on echo
if test "X`echo -n`" = "X-n"
then
	en=''
else
	en='-n'
fi
if test "X`echo '\c'`" = "X\c"
then
	ec=''
else
	ec='\c'
fi










fstyp="-k -l"
Slevel=3000
Klevel=3000
rcdir=/etc











echo $en "Shall I remove all EtherShare kernel modifications from your system? "$ec
read line
if test "$line" != "y"
then
	exit 1
fi

$ESDIR/stop-atalk now

# remove the daily crontab entry for es.daily
tabfile=/tmp/crtab$$
crontab -l >$tabfile
grep 'es\.daily' $tabfile >/dev/null 2>&1
if test $? -eq 0
then
ed - $tabfile >/dev/null <<eof
/es\.daily/d
w
q
eof
        crontab <$tabfile
fi
rm -f $tabfile

# remove all shared library symlinks

for i in $ESDIR/lib/*
do
	rm -f /usr/lib/`basename $i`
done

if test X$Slevel != X
then
	rm -f $rcdir/rc?.d/S${Slevel}atalk
	rm -f $rcdir/rc?.d/K${Klevel}atalk
fi



if test -f "$SYSCF/$hostupper"
then
	CFG="$hostupper"
fi















echo "All EtherShare kernel modifications have now been removed."
echo "Please delete the EtherShare directory $ESDIR manually."
