#!/bin/sh
# $Id: install.sh,v 1.1 1998/12/30 19:53:05 danw Exp $

PATH=/srvd/usr/athena/bin:/usr/athena/bin:/bin:/sbin:/usr/bin:/usr/sbin
PATH=${PATH}:/hd/bin:/hd/sbin:/hd/usr/sbin
PATH=${PATH}:/os/bin:/os/sbin:/os/usr/bin:/os/usr/sbin
PATH=${PATH}:/hd/bin/athena:/hd/etc/athena:/hd/usr/athena/bin
PATH=${PATH}:/hd/usr/athena/etc:/srvd/bin/athena:/srvd/etc/athena
PATH=${PATH}:/srvd/usr/athena/etc
export PATH
export ENV=
export TERM=pc3
export KRBTKFILE=/tmp/tkt0

# /tmp/vars outputs:
#	revision	install.sh revision number

. /tmp/vars

fail() {
	echo ""
	echo "The installation procedure has failed.  If you wish to restart"
	echo "the installation procedure, type 'exit'."
	echo "If you need help, please contact SIPB at netbsd-help@mit.edu"
	echo "or x3-7788.  To halt and reboot your machine, type 'halt' now."
	exit 1
}

echo "/srvd/install/install" > /tmp/.installer
trap fail 2

umount /hd/u1/usr/vice/cache /hd/u1 /hd >/dev/null 2>&1

echo ""
echo "If you have special requirements and know what you're doing, pressing"
echo "^C at this point will give you a shell prompt with a full suite of"
echo "NetBSD commands (fdisk, etc.)."
echo ""
echo "If you have problems during this installation, you can restart it by"
echo "pressing ^C and typing '/srvd/install/install'."

revision='$Revision: 1.1 $'
cat >> /tmp/vars << EOM
revision='$revision'
EOM

(
/srvd/install/hdinfo || fail
/srvd/install/questions || fail
/srvd/install/disksetup || fail
/srvd/install/unpack || fail
/srvd/install/track || fail
/srvd/install/config || fail
/srvd/install/mail || fail
) 2>&1 | tee /tmp/install.log
cp /tmp/install.log /hd/var/athena/install.log

. /tmp/vars

case "$action" in
	reboot)
		echo "Installation complete.  Rebooting... "
		reboot
		;;
	halt)
		echo "Installation complete.  Halting... "
		halt
		;;
	shell)
		echo 'Installation complete.  Be certain to use the "halt"'
		echo "command when rebooting your machine; otherwise your"
		echo "filesystem WILL be left in an inconsistent state, and"
		echo "your machine will not function properly."
		;;
esac
