#!/bin/sh
#
#	HylaFAX v4.0pl1 pre-remove script
#	(c) Matthias Apitz, 01.12.1996
#
#
ROOT=/usr/local/lib/HylaFAX-v4.0
#
#	don't touch file above $ROOT
#
cd $ROOT
test -x /usr/bin/clear && /usr/bin/clear
test -x /bin/clear     && /bin/clear
#
cat <<EOF-EOF-EOF

HylaFAX v4.0pl1 pre-remove script.

The package removal normaly removes all files which were installed
by pkgadd(1M) but some of these files you may later want to reuse. 
That's why we give you a last chance here to KEEP the following
files (a suffix KEEP will be added using the mv(1) command):

     spool/etc/hosts
     spool/etc/xferlog
     spool/etc/pagermap
     spool/etc/FaxDispatch
     spool/etc/config.*
     lib/*.ps

EOF-EOF-EOF

/bin/echo -n "Hit \"n\" or \"N\" if you DON't want to KEEP these files: "
read resp
if [ "x$resp" = "xn" -o "x$resp" = "xN" ]; then
	echo "OK - you get what you want, don't cry later...."
fi
for name in 		\
          spool/etc/hosts	\
          spool/etc/xferlog	\
          spool/etc/pagermap	\
	  spool/etc/FaxDispatch \
          spool/etc/config.*	\
          lib/*.ps
do
	test -f $name || continue;
	if [ "x$resp" = "xn" -o "x$resp" = "xN" ]; then
		echo ".... removing $name"
		rm -f $name
	else
		echo ".... renaming $name to $name.KEEP"
		mv $name $name.KEEP
	fi
done
/bin/echo -n "Hit ENTER to continue: "
read resp

test -x /usr/bin/clear && /usr/bin/clear
test -x /bin/clear     && /bin/clear
#
cat <<EOF-EOF-EOF

Next we're cleaning up the spooling area and trying to remove all
files which were created during the life time of HylaFAX:

     spool/bin/ps2fax              spool/dev/null
     spool/dev/tcp                 spool/dev/socksys
     spool/client/*                spool/docq/*
     spool/doneq/*                 spool/etc/config
     spool/etc/setup.modem         spool/etc/setup.cache
     spool/etc/netconfig           spool/etc/lastrun
     spool/info/*                  spool/log/*
     spool/recvq/*                 spool/sendq/*
     spool/status/*                spool/tmp/*
     spool/FIFO                    spool/FIFO.*

If you don't like to remove these files now you should later copy them
over to some other place. Please remove them BEFORE INSTALLING a new
HylaFAX distribution.

EOF-EOF-EOF

/bin/echo -n "Hit \"y\" or \"Y\" if you want to REMOVE these files: "
read resp
if [ "x$resp" = "xy" -o "x$resp" = "xY" ]; then
	echo "OK - you get what you want, don't cry later...."
for name in             \
     spool/bin/ps2fax              spool/dev/null		\
     spool/dev/tcp                 spool/dev/socksys		\
     spool/client/*                spool/docq/*			\
     spool/doneq/*                 spool/etc/config		\
     spool/etc/setup.modem         spool/etc/setup.cache	\
     spool/etc/netconfig           spool/etc/lastrun		\
     spool/info/*                  spool/log/*			\
     spool/recvq/*                 spool/sendq/*		\
     spool/status/*                spool/tmp/*			\
     spool/FIFO                    spool/FIFO.*
do
	test -r $name || continue;
	echo ".... removing $name"
	rm -f $name
done
fi
cat <<EOF-EOF-EOF

HylaFAX v4.0pl1 pre-remove script done.

EOF-EOF-EOF
exit 0
