#ident	"@(#)/proto/install/3.2.2 3fg19 patch/INSTALL.sl  2/8/90 41697 "
#
# Multiple Floppy INSTALL Script
#
#
# Save mount point of floppy (INSPATH), package name (PKGNAME) and
# information for the mount & umount commands (mntdev & mntname).
#


INSPATH=/install/new
PKGNAME=`cat $INSPATH/usr/options/*`
VERS="`uname -v`"
REL="`uname -r`"
LAST=1


if `/bin/cmp /bin/cpio $INSPATH/bin/cpio >/dev/null 2>&1`
then
	echo "\nNOTICE!!!	This machine already has cpio.3.2.3 installed!"
	echo "Installation aborted!"
	exit
fi

case $REL in
	3.0)	;;
	3.1)	;;
	3.2)	;;
	3.1.1)	;;
	3.2.1)	;;
	3.2.2)	;;
	*)	
		echo
		echo "\nWarning: ${PKGNAME} not installable on "
		echo "         3B2 computers running a swapping release "
		echo "         or paging releases beyond 3.2 or 3.2.2."
		echo
		echo "         ${PKGNAME} not installed."
		echo 
		exit 1
		;;
esac

if
	test -b "$1"
then
	mntdev=$1
elif
	test -b /dev/diskette
then
	mntdev=/dev/diskette
elif
	test -b /dev/install
then
	mntdev=/dev/install
else
	echo "**ERROR**   Can't find mount device"
	exit
fi
mntname=${2:-/install}

echo "\nInstalling the ${PKGNAME}."
echo "Copyright (c) 1990 AT&T"
echo "All Rights Reserved"

#
# Begin loop for multiple floppies
#

expect=1
while
	[ $expect -le $LAST ]
do
	if
		[ $expect -gt 1 ]
	then
		cd /
		/etc/umount $mntdev 2>/dev/null
		if [ -n "$INSTTAPE" ]
		then readpkg
		else
		echo "Remove floppy and insert floppy number $expect"
		echo "Type <return> when ready:  \c"
		read answer
		fi
		/etc/mount $mntdev $mntname -r 2>/dev/null
	fi

	#
	# Check to make sure this is the correct floppy of the set.
	#

	answer=""
	while
		[ `cat /install/install/ORDER` != $expect -a "$answer" != y ]
	do
		echo "**WARNING**   Floppy out of sequence"
		echo "Expecting floppy diskette number $expect"
		while
			[ "$answer" != y -a "$answer" != n ]
		do
			echo "Type 'y' to continue or \c"
			echo "'n' to try another floppy:  \c"
			read answer
		done
		case $answer in
			n)	cd /
				/etc/umount $mntdev 2>/dev/null
				echo "Remove floppy and insert correct floppy"
				echo "Type <return> when ready:  \c"
				read answer

				#
				# Reset answer to ""
				# check to make sure that this
				# is now the correct floppy
				#

				answer=""
				/etc/mount $mntdev $mntname -r 2>/dev/null
				;;

			y)	expect=`cat /install/install/ORDER`
				;;
		esac
	done

	/install/install/setup

	echo "\nThe following files are being installed: "
	
	cd ${INSPATH}
	find . -print | bin/cpio -pduvm /

	#
	# Increment number for next expected floppy.
	#

	if [ -n "$INSTTAPE" ]
	then
	echo "Part $expect is complete"
	else
	echo "Floppy diskette number $expect is complete"
	fi
	expect=`expr $expect + 1`
done



#
# Give user closing message
#

cd /
/install/install/postinstall
echo "\nInstallation of the ${PKGNAME} package is complete."
exit

