Subject: standalone floppy shell script
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Christos Zoulas <christos@deshaw.com>
List: current-users
Date: 07/05/1994 15:05:18
I cleaned up the script posted a while ago by Hellmuth Michaelis
<hm@hcswork.hcs.de> (thanks!), and made it work with vnode devices.

I offer no guarantees, it works for me!

christos

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  mkboot i0-dot_profile i1-dirlist i1-dot_profile i1-install
#   i2-dot_profile i2-install
# Wrapped by christos@cs4 on Tue Jul  5 15:02:37 1994
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'mkboot' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mkboot'\"
else
echo shar: Extracting \"'mkboot'\" \(7677 characters\)
sed "s/^X//" >'mkboot' <<'END_OF_FILE'
X#!/bin/sh
X#---------------------------------------------------------------------------
X#
X#	make a set of boot-floppies
X#	===========================
X#
X#	Hellmuth Michaelis (hm@hcswork.hcs.de)
X#	Christos Zoulas (christos@deshaw.com)
X#
X#	last edit-date: [Tue Jul  5 14:05:16 EDT 1994]
X#
X#	-cz	strip the kernel so that it fits :-(
X#	-cz	use vnd or floppies
X#	-cz	Use copyfile to find the appropriate file to be copied
X#	-cz	select the floppy to be made
X#	-cz	cleanup things into functions
X#	-cz	copy binaries from the standalone directory if possible
X#	-hm	using 0.9 as template
X#	-hm	making it friendlier ...
X#	-hm	optimizing & debugging
X#	-hm	checking for static binaries
X#	-hm	cleaning up
X#
X#---------------------------------------------------------------------------
X
X# The directory where the statically linked stand-alone files live
Xstanddir=/usr/src/sys/arch/i386/floppy
X
Xvnd=/dev/vnd0a
X
X# the floppy mount point
Xfdmnt=/mnt
X
X# the source directory where the data files [i1-profile etc] live
Xsrcdir=`pwd`
X
X# the device for your 3,5" floppy disk drive (fd0 or fd1)
Xfdev=fd0
X
X# floppy partition 
Xpart=a
X
X# the kernel you want to use
Xkerneldir=/usr/src/sys/arch/i386/compile/FLOPPY
X
X# Use the vnode device
Xmount=mountvn
Xumount=umountvn
X
X# Use the floppy directly
X#mount=mountfl
X#umount=umountfl
X
X
Xaskready() {
X    echo ""
X    echo -n "Enter <CR> if ready, ^C to abort .... "
X    read reply
X    echo ""
X}
X
X
Xmakedirs() {
X    echo -n "making directories: "
X    for i in "$@"
X    do
X	echo -n "$i.."
X	mkdir $fdmnt$i
X    done
X    echo
X}
X
X
Xcopyfiles() {
X    dir=$1
X    shift
X    echo -n "copy files from $dir: "
X    for i in "$@"
X    do
X       copyfile $i $fdmnt/$dir
X    done
X    echo
X}
X
X
Xmakedevs() {
X    echo -n "making device files in /dev: $@"
X    cwd=`pwd`
X    cd $fdmnt/dev
X    cp /dev/MAKEDEV .
X    $fdmnt/dev/MAKEDEV "$@"
X    cd $cwd
X    echo
X}
X
X
Xcopyfile() {
X    z=
X    for i in $standdir/$1/obj /bin /usr/bin /sbin /usr/sbin /etc
X    do
X	if [ -f $i/$1 ]
X	then
X	    echo -n "$1.."
X	    install -c -s $i/$1 $2 2> /dev/null
X	    z=$i/$1
X	    break
X	fi
X    done
X    if [ "x$z" = "x" ]
X    then
X	echo "$1 not found"
X    fi
X}
X
X
Xstatfile() {
X    z=
X    for i in $standdir/$1/obj /bin /usr/bin /sbin /usr/sbin
X    do
X	if [ -f $i/$1 ]
X	then
X	    file $i/$1 | grep dynamically >/dev/null 2>&1
X	    if test $? -ne 0
X	    then
X		echo "$i/$1..statically linked ok"
X		z=$i/$1
X		break
X	    else
X		echo "$i/$1..dynamically linked; please relink statically"
X		exit 1
X	    fi
X	fi
X    done
X
X    if [ "x$z" = "x" ]
X    then
X	echo "$1 not found"
X	exit 1
X    fi
X}
X
X
Xmountvn() {
X    loc=$1
X    shift
X    dd if=/dev/zero of=$loc bs=100k count=12
X    vnconfig -c $vnd $loc
X
X    echo "writing disklabel to floppy"
X    disklabel -r -w $vnd floppy5 /usr/mdec/fdboot /usr/mdec/bootfd
X
X    echo "initializing floppy filesystem $*"
X    newfs -m 0 -o space $@ $vnd floppy5
X
X    echo "mounting vn"
X    mount $vnd $fdmnt
X}
X
X
Xumountvn() {
X     echo "unmounting vn"
X     umount $fdmnt
X     vnconfig -u $vnd $1
X}
X
X
Xmountfl() {
X    echo "Put a formatted, writable floppydisk into drive /dev/$fdev"
X
X    askready
X
X    echo "unmounting floppy"
X    umount /dev/$fdev/$part
X
X    echo "writing disklabel to floppy"
X    echo
X    disklabel -r -w /dev/$fdev/$part floppy5 /usr/mdec/fdboot /usr/mdec/bootfd
X    echo
X
X    echo "initializing floppy filesystem"
X    newfs -m0 -ospace /dev/r$fdev$part floppy5
X
X    echo "mounting floppy"
X    mount /dev/$fdev$part $fdmnt
X}
X
X
Xumountfl()
X{
X    echo "printing size of floppy [df -ik]"
X    echo
X    df -ik $fdmnt
X    echo
X
X    echo "unmounting floppy"
X    umount /dev/$fdev$part
X
X    echo "checking floppy"
X    fsck /dev/r$fdev$part
X
X    echo 
X    echo "REMOVE THE FLOPPY from the drive and label it NOW !"
X    echo 
X
X    askready
X}
X
X# ===========================================================================
X# ===========================================================================
X# ===========================================================================
X
Xfloppy1() {
X    echo " ==============================="
X    echo " Step 1: Make kernel boot floppy"
X    echo " ==============================="
X    echo
X
X    $mount /snapshot/kern.fs -i 6144 -c 80
X
X    echo "copy kernel: $kerneldir/netbsd"
X    install -c -s $kerneldir/netbsd $fdmnt
X
X    echo "copy root files: .profile"
X    cp $srcdir/i0-dot_profile $fdmnt/.profile
X
X    makedirs /bin /dev /mnt /sbin
X
X    copyfiles /bin cp echo sh test
X
X    ln $fdmnt/bin/test $fdmnt/bin/\[
X
X    makedevs std wd0 wd1 sd0 sd1 fd0 fd1 tty0 pty0 st0
X
X    copyfiles /sbin fsck halt init mount umount
X
X    $umount /snapshot/kern.fs
X}
X
X# ===========================================================================
X# ===========================================================================
X# ===========================================================================
X
Xfloppy2() {
X    echo
X    echo " =============================="
X    echo " Step 2: Make filesystem floppy"
X    echo " =============================="
X    echo
X
X    $mount /snapshot/inst-1.fs -i 4096 -c 40
X
X    echo -n "copy root files: "
X    echo -n ".profile.. "
X    cp $srcdir/i1-dot_profile $fdmnt/.profile
X    echo -n "dirlist.. "
X    cp $srcdir/i1-dirlist $fdmnt/dirlist
X    echo "install.. "
X    cp $srcdir/i1-install $fdmnt/install
X
X    makedirs /bin /dev /etc /kern /mnt /sbin /usr
X
X    copyfiles /bin cat df expr ls mkdir sh sync test
X    ln $fdmnt/bin/test $fdmnt/bin/\[
X
X    makedevs std wd0 wd1 sd0 sd1 fd0 fd1 tty0 pty0 st0
X
X    copyfiles disktab group master.passwd passwd pwd.db spwd.db
X    cp /etc/disktab $fdmnt/etc/disktab.preinstall
X
X    copyfiles /sbin disklabel reboot init mount newfs # bad144
X    ln $fdmnt/sbin/reboot $fdmnt/sbin/halt
X
X    makedirs /usr/bin /usr/mdec /usr/sbin
X
X    copyfiles /usr/bin tar
X
X    echo -n "copy files from /usr/mdec: "
X    echo -n "bootfd.. "
X    cp /usr/mdec/bootfd $fdmnt/usr/mdec/bootfd
X    ln $fdmnt/usr/mdec/bootfd $fdmnt/usr/mdec/bootsd
X    ln $fdmnt/usr/mdec/bootfd $fdmnt/usr/mdec/bootwd
X    echo "fdboot.. "
X    cp /usr/mdec/fdboot $fdmnt/usr/mdec/fdboot
X    ln $fdmnt/usr/mdec/fdboot $fdmnt/usr/mdec/sdboot
X    ln $fdmnt/usr/mdec/fdboot $fdmnt/usr/mdec/wdboot
X
X    $umount /snapshot/inst-1.fs
X}
X
X# ===========================================================================
X# ===========================================================================
X# ===========================================================================
X
Xfloppy3() {
X    echo
X    echo " ==============================="
X    echo " Step 3: Make 2nd install floppy"
X    echo " ==============================="
X    echo
X
X    $mount /snapshot/inst-2.fs -i 10000 -c 40
X
X    echo -n "copy root files: "
X    echo -n ".profile.. "
X    cp $srcdir/i2-dot_profile $fdmnt/.profile
X    echo "install.. "
X    cp $srcdir/i2-install $fdmnt/install
X
X    makedirs /bin /etc /sbin /tmp /usr
X
X    copyfiles /bin chmod cp mv pwd rm stty
X
X    copyfiles /etc protocols services
X
X    copyfiles /sbin ifconfig mknod route shutdown slattach umount
X
X    makedirs /usr/bin /usr/sbin
X
X    copyfiles /usr/bin ftp gzip more # tip
X    ln $fdmnt/usr/bin/gzip $fdmnt/usr/bin/gunzip
X    ln $fdmnt/usr/bin/gzip $fdmnt/usr/bin/gzcat
X
X    # makedirs /usr/local /usr/local/bin
X    # copyfiles /usr/local/bin mread rz
X
X    copyfiles /usr/sbin update
X
X    $umount /snapshot/inst-2.fs
X}
X
Xfor i in tar ftp gzip more # bad144 tip mread rz
Xdo
X    statfile $i
Xdone
X
Xclear
X
Xecho 
Xecho "    Make Boot Floppy Disks"
Xecho "    ======================"
Xecho
Xecho " This script tries to make a set of three 3,5 inch"
Xecho " floppies which can be used as a recovery system."
Xecho
Xif [ x$1 != x ]
Xthen
X    floppy$1
Xelse
X    floppy1
X    floppy2
X    floppy3
Xfi
X
X
Xecho
X
Xexit 0
END_OF_FILE
if test 7677 -ne `wc -c <'mkboot'`; then
    echo shar: \"'mkboot'\" unpacked with wrong size!
fi
chmod +x 'mkboot'
# end of 'mkboot'
fi
if test -f 'i0-dot_profile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'i0-dot_profile'\"
else
echo shar: Extracting \"'i0-dot_profile'\" \(1559 characters\)
sed "s/^X//" >'i0-dot_profile' <<'END_OF_FILE'
X# $Header
X#
X# rc for kernel distribution floppy
X
XPATH=/bin:/sbin
Xexport PATH
X
X#test=echo
X
Xreboot_it() {
X	echo    ""
X	echo    "halting the machine..."
X	
X	${test} halt
X}
X
Xbail_out() {
X	echo    ""
X	echo	"Time to reboot the machine!"
X	echo	"Once the machine has halted (it'll tell you when),"
X	echo	"remove the floppy from the disk drive and press"
X	echo    "any key to reboot."
X	reboot_it
X}
X
Xecho    enter '"copy"' at the prompt to copy the kernel on this
Xecho    floppy to your hard disk.  enter anything else to reboot,
Xecho	but wait for the machine to restart to remove the floppy.
Xecho    ""
Xecho -n "> "
X
Xread todo
X
Xif [ "$todo"X = copyX ]; then
X	echo    ""
X	echo    "what disk partition should the kernel be installed on?"
X	echo    "(e.g. "wd0a", "sd0a", etc.)"
X	echo    ""
X	echo -n "> "
X	
X	read diskpart
X
X	echo    ""
X	echo    "checking the filesystem on $diskpart..."
X
X	${test} fsck -y /dev/r$diskpart
X	if [ $? -ne 0 ]; then
X		echo ""
X		echo "fsck failed...  sorry, can't copy kernel..."
X		bail_out
X	fi
X
X	echo    ""
X	echo    "mounting $diskpart on /mnt..."
X
X	${test} mount /dev/$diskpart /mnt
X	if [ $? -ne 0 ]; then
X		echo ""
X		echo "mount failed...  sorry, can't copy kernel..."
X		bail_out
X	fi
X
X	echo    ""
X	echo    "copying kernel..."
X
X	${test} cp /netbsd /mnt/netbsd
X	if [ $? -ne 0 ]; then
X		echo ""
X		echo "copy failed...  (?!?!?!)"
X		bail_out
X	fi
X
X	echo    ""
X	echo    "unmounting $diskpart..."
X
X	${test} umount /mnt > /dev/null 2>&1
X	if [ $? -ne 0 ]; then
X		echo ""
X		echo "unmount failed...  shouldn't be a problem..."
X	fi
X
X	bail_out
Xfi
X
Xreboot_it
END_OF_FILE
if test 1559 -ne `wc -c <'i0-dot_profile'`; then
    echo shar: \"'i0-dot_profile'\" unpacked with wrong size!
fi
# end of 'i0-dot_profile'
fi
if test -f 'i1-dirlist' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'i1-dirlist'\"
else
echo shar: Extracting \"'i1-dirlist'\" \(26 characters\)
sed "s/^X//" >'i1-dirlist' <<'END_OF_FILE'
Xbin
Xdev
Xetc
Xkern
Xsbin
Xusr
END_OF_FILE
if test 26 -ne `wc -c <'i1-dirlist'`; then
    echo shar: \"'i1-dirlist'\" unpacked with wrong size!
fi
# end of 'i1-dirlist'
fi
if test -f 'i1-dot_profile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'i1-dot_profile'\"
else
echo shar: Extracting \"'i1-dot_profile'\" \(134 characters\)
sed "s/^X//" >'i1-dot_profile' <<'END_OF_FILE'
XPATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/contrib/bin:.:
Xexport PATH
XHOME=/root
Xexport HOME
XTERM=pc3
Xexport TERM
Xinstall
END_OF_FILE
if test 134 -ne `wc -c <'i1-dot_profile'`; then
    echo shar: \"'i1-dot_profile'\" unpacked with wrong size!
fi
# end of 'i1-dot_profile'
fi
if test -f 'i1-install' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'i1-install'\"
else
echo shar: Extracting \"'i1-install'\" \(10967 characters\)
sed "s/^X//" >'i1-install' <<'END_OF_FILE'
X#!/bin/sh
X# install1.fs disk 'install'
X# Simplified, interactive NetBSD installation script.
X# D.E. Silvia (dsilvia@net.com)
X#
X# (heavily hacked by cgd)
X# (and again by rwgrimes, for bad144 support and some error checking)
X#
X# (once again hacked on by rgrimes 1993/07/29,
X#  disabled old disktab.preinstall,
X#  added questions for what blocking factor to use in the file system,
X#	-- later deleted by cgd, because it's too complicated; fs's are 8k/1k
X#  added (heads) to clarify what disk tracks means)
X#
X# Provides for variable swap and multiple partitions.
X#
X# Installs first minimal part of basic NetBSD system.
X#
X# Does not appear to work properly IF not using whole disk _AND_ there is
X# no DOS partition (kernel bug?  Tries to chroot to partition 'd' :-{ )
X#
X# Currently, no method for checking to see if the designated disk type is
X# already in /etc/disktab.  You can edit it out of the file after installation.
X#
X
Xecho    "Welcome to NetBSD-current!"
Xecho    ""
Xecho    "This program is designed to help you put NetBSD on your hard disk,"
Xecho    "in a simple and rational way.  You'll be asked several questions,"
Xecho    "and it would probably be useful to have your disk's hardware"
Xecho	"manual, the installation notes, and a calculator handy."
Xecho    ""
Xecho	"In particular, you will need to know some reasonably detailed"
Xecho	"information about your disk's geometry, because there is currently"
Xecho	"no way this this program can figure that information out."
Xecho    ""
Xecho	"As with anything which modifies your hard drive's contents, this"
Xecho	"program can cause SIGNIFICANT data loss, and you are advised"
Xecho	"to make sure your hard drive is backed up before beginning the"
Xecho	"installation process."
Xecho    ""
Xecho -n "Proceed with installation? [n] "
Xread resp
Xcase $resp in
X	y*|Y*)
X		echo    "Ice-Cool!  Let's get to it..."
X		;;
X	*)
X		echo    ""
X		echo    "OK, then.  enter 'halt' to halt the machine."
X		echo    "Once the machine has halted, remove the floppy,"
X		echo    "and press any key to reboot."
X		exit
X		;;
Xesac
Xecho    ""
Xecho    "Drive types can be ESDI, SCSI, ST506, or IDE."
Xecho -n "Drive type? "
Xread type
Xcase "$type" in
X	esdi|ESDI|st506|ST506)
X		drivename=wd0
X		drivetype=wd
X		echo -n "Does it support _automatic_ sector remapping? [y] "
X		read remap
X		case "$remap" in
X			n*|N*)
X				sect_fwd="sf:"
X				;;
X			*)
X				sect_fwd=""
X				;;
X		esac
X		;;
X	ide|IDE)
X		drivename=wd0
X		drivetype=wd
X		sect_fwd=""
X		type=ST506
X		;;
X	scsi|SCSI)
X		drivename=sd0
X		drivetype=sd
X		sect_fwd=""
X		type=SCSI
X		;;
Xesac
Xecho    ""
Xecho    "Disk is of type $drivetype"
Xecho    "going to install on $drivename..."
Xecho    ""
Xecho -n "Label name (what kind of disk is it, one word please)? "
Xread name
Xecho	""
Xecho -n "Number of bytes per disk sector? [512] "
Xread bytes_per_sect
Xif [ "$bytes_per_sect" = "" ]; then
X	bytes_per_sect=512
Xfi
Xecho	""
Xecho -n "Number of disk cylinders? "
Xread cyls_per_disk
Xecho	""
Xecho -n "Number of disk tracks (heads) per disk cylinder? "
Xread tracks_per_cyl
Xecho	""
Xecho -n "Number of disk sectors per disk track? "
Xread sects_per_track
Xecho	""
Xcylindersize=`expr $sects_per_track \* $tracks_per_cyl`
Xdisksize=`expr $cylindersize \* $cyls_per_disk`
Xecho    "Disk has a total of $disksize $bytes_per_sect byte sectors"
Xecho    "For greater efficiency, partitions should begin and end on cylinder"
Xecho    "boundaries.  Cylinder size (in $bytes_per_sect byte sectors) on this"
Xecho    "disk is $cylindersize.  Choose multiples of this value."
Xecho	""
Xecho -n "Size of NetBSD portion of disk (in $bytes_per_sect byte sized sectors)? "
Xread partition
Xpart_offset=0
Xif [ $partition -lt $disksize ]; then
X	echo -n "Offset of NetBSD portion of disk (in $bytes_per_sect byte sized sectors) "
X	read part_offset
Xfi
Xbadspacesec=0
Xif [ "$sect_fwd" = "sf:" ]; then
X	badspacecyl=`expr $sects_per_track + 126`
X	badspacecyl=`expr $badspacecyl + $cylindersize - 1`
X	badspacecyl=`expr $badspacecyl / $cylindersize`
X	badspacesec=`expr $badspacecyl \* $cylindersize`
X	echo ""
X	echo -n "Using $badspacesec sectors ($badspacecyl cylinders) for the "
X	echo "bad144 bad block table"
Xfi
Xwhats_left=`expr $partition - $badspacesec`
Xcyl_left=`expr $whats_left / $cylindersize`
Xecho	""
Xecho	"There are $whats_left sectors ($cyl_left cylinders) left to allocate"
Xecho	""
Xroot=0
Xwhile [ $root -eq 0 ]; do
X	echo -n "Root partition size (in $bytes_per_sect byte sized sectors)? "
X	read root
X	case $root in
X		[1-9]*)
X			total=$root
X			if [ $total -gt $whats_left ]; then
X				echo Total is greater than remaining free space
X				root=0
X			else
X				part_used=`expr $root + $badspacesec`
X			fi
X			;;
X		*)
X			root=0
X			;;
X	esac
Xdone
Xroot_offset=$part_offset
Xwhats_left=`expr $partition - $part_used`
Xecho	""
Xswap=0
Xwhile [ $swap -eq 0 ]; do
X	echo    "$whats_left sectors remaining in NetBSD portion of disk"
X	echo -n "Swap partition size (in $bytes_per_sect byte sized sectors)? "
X	read swap 
X	case $swap in
X		[1-9]*)
X			if [ $swap -gt $whats_left ]; then
X				echo Swap size is greater than remaining free space
X				swap=0
X			fi
X			;;
X		*)
X			swap=0
X			;;
X	esac
Xdone
Xecho    ""
X
Xswap_offset=`expr $root_offset + $root`
Xpart_used=`expr $part_used + $swap`
X
Xfragsize=1024
Xblocksize=8192
X
Xmount -u /dev/fd0a /
Xecho    "" >/etc/disktab
Xecho    "$name|NetBSD installation generated:\\" >>/etc/disktab
Xecho    "	:dt=${type}:ty=winchester:\\" >>/etc/disktab
Xecho -n "	:nc#${cyls_per_disk}:ns#${sects_per_track}" >>/etc/disktab
Xecho    ":nt#${tracks_per_cyl}:\\" >>/etc/disktab
Xecho    "	:se#${bytes_per_sect}:${sect_fwd}\\" >>/etc/disktab
Xecho -n "	:pa#${root}:oa#${root_offset}" >>/etc/disktab
Xecho    ":ta=4.2BSD:ba#${blocksize}:fa#${fragsize}:\\" >>/etc/disktab
Xecho    "	:pb#${swap}:ob#${swap_offset}:tb=swap:\\" >>/etc/disktab
Xecho    "	:pc#${partition}:oc#${part_offset}:\\" >>/etc/disktab
Xename="";fname="";gname="";hname=""
X
Xecho    ""
Xecho	"You will now have to enter information about any other partitions"
Xecho	"to be created in the NetBSD portion of the disk.  This process will"
Xecho	"be complete when you've filled up all remaining space in the NetBSD"
Xecho	"portion of the disk."
X
Xwhile [ $part_used -lt $partition ]; do
X	part_size=0
X	whats_left=`expr $partition - $part_used`
X	while [ $part_size -eq 0 ]; do
X		echo	""
X		echo    "$whats_left sectors remaining in NetBSD portion of disk"
X		echo -n "Next partition size (in $bytes_per_sect byte sized sectors)? "
X		read part_size
X		case $part_size in
X			[1-9]*)
X				total=`expr $part_used + $part_size`
X				if [ $total -gt $partition ]; then
X					echo Total is greater than partition size
X					part_size=0
X				else
X					part_used=$total
X					part_name=""
X					while [ "$part_name" = "" ]; do
X						echo -n "Mount point? "
X						read part_name
X					done
X				fi
X				;;
X			*)
X				part_size=0
X				;;
X		esac
X	done
X	if [ "$ename" = "" ]; then	
X		ename=$part_name
X		offset=`expr $part_offset + $root + $swap`
X		echo -n "	:pe#${part_size}:oe#${offset}" >>/etc/disktab
X		echo ":te=4.2BSD:be#${blocksize}:fe#${fragsize}:\\" >>/etc/disktab
X		offset=`expr $offset + $part_size`
X	elif [ "$fname" = "" ]; then
X		fname=$part_name
X		echo -n "	:pf#${part_size}:of#${offset}" >>/etc/disktab
X		echo ":tf=4.2BSD:bf#${blocksize}:ff#${fragsize}:\\" >>/etc/disktab
X		offset=`expr $offset + $part_size`
X	elif [ "$gname" = "" ]; then
X		gname=$part_name
X		echo -n "	:pg#${part_size}:og#${offset}" >>/etc/disktab
X		echo ":tg=4.2BSD:bg#${blocksize}:fg#${fragsize}:\\" >>/etc/disktab
X		offset=`expr $offset + $part_size`
X	elif [ "$hname" = "" ]; then
X		hname=$part_name
X		echo -n "	:ph#${part_size}:oh#${offset}" >>/etc/disktab
X		echo ":th=4.2BSD:bh#${blocksize}:fh#${fragsize}:\\" >>/etc/disktab
X		part_used=partition
X	fi
Xdone
X
Xecho    "	:pd#${disksize}:od#0:" >>/etc/disktab
Xcat /etc/disktab.preinstall >> /etc/disktab
Xsync
X
Xecho    ""
Xecho    "OK!  THIS IS YOUR LAST CHANCE!!!"
Xecho -n "Are you sure you want this stuff installed on your hard drive? (yes/no) "
Xanswer=""
Xwhile [ "$answer" = "" ]; do
X	read answer
X	case $answer in
X		yes|YES)
X			echo    ""
X			echo    "OK!  Here we go..."
X			;;
X		no|NO)
X			echo    ""
X			echo    "OK, then.  enter 'halt' to halt the machine."
X			echo    "Once the machine has halted, remove the floppy,"
X			echo    "and press any key to reboot."
X			exit
X			;;
X		*)
X			echo -n "I want a yes or no answer...  well? "
X			answer=
X			;;
X	esac
Xdone
X
Xecho    ""
Xecho -n "Labelling disk..."
Xdisklabel -w -r $drivename $name /usr/mdec/${drivetype}boot /usr/mdec/boot${drivetype}
Xecho    " done."
X
Xif [ "$sect_fwd" = "sf:" ]; then
X	echo -n "Initializing bad144 badblock table..."
X	bad144 $drivename 0
X	echo " done."
Xfi
X
Xecho    "Initializing root filesystem, and mounting..."
Xnewfs /dev/r${drivename}a $name
Xmount -v /dev/${drivename}a /mnt
Xif [ "$ename" != "" ]; then
X	echo    ""
X	echo    "Initializing $ename filesystem, and mounting..."
X	newfs /dev/r${drivename}e $name
X	mkdir -p /mnt/$ename
X	mount -v /dev/${drivename}e /mnt/$ename
Xfi
Xif [ "$fname" != "" ]; then
X	echo    ""
X	echo    "Initializing $fname filesystem, and mounting..."
X	newfs /dev/r${drivename}f $name
X	mkdir -p /mnt/$fname
X	mount -v /dev/${drivename}f /mnt/$fname
Xfi
Xif [ "$gname" != "" ]; then
X	echo    ""
X	echo    "Initializing $gname filesystem, and mounting..."
X	newfs /dev/r${drivename}g $name
X	mkdir -p /mnt/$gname
X	mount -v /dev/${drivename}g /mnt/$gname
Xfi
Xif [ "$hname" != "" ]; then
X	echo    ""
X	echo    "Initializing $hname filesystem, and mounting..."
X	newfs /dev/r${drivename}h $name
X	mkdir -p /mnt/$hname
X	mount -v /dev/${drivename}h /mnt/$hname
Xfi
X
Xecho    ""
Xecho -n "Verbose installation? [n] "
Xread resp
X
Xecho Copying to disk...
Xcd /
Xcase $resp in
X	y*)
X		tarverbose=v
X		;;
X	*)
X		tarverbose=
X		;;
Xesac
X
Xtar cfp - `cat /dirlist` | (cd /mnt ; tar xfp${tarverbose} - )
Xmkdir /mnt/mnt
X
Xcd /mnt
X
Xecho /dev/${drivename}a / ufs rw 1 1 >etc/fstab
Xecho "kernfs /kern kernfs rw 1 1" >>etc/fstab
Xif [ "$ename" != "" ]; then
X	echo /dev/${drivename}e /$ename ufs rw 1 2 >>etc/fstab
Xfi
Xif [ "$fname" != "" ]; then
X	echo /dev/${drivename}f /$fname ufs rw 1 3 >>etc/fstab
Xfi
Xif [ "$gname" != "" ]; then
X	echo /dev/${drivename}g /$gname ufs rw 1 4 >>etc/fstab
Xfi
Xif [ "$hname" != "" ]; then
X	echo /dev/${drivename}h /$hname ufs rw 1 5 >>etc/fstab
Xfi
X
Xcat << EOF >.profile
XPATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/contrib/bin:.:
Xexport PATH
XHOME=/root
Xexport HOME
XTERM=pc3
Xexport TERM
Xecho    ""
Xecho    "Insert second installation floppy in drive and"
Xecho -n "enter that drive's number (e.g. 0 or 1): "
Xread driveno
Xmount -o ro /dev/fd\${driveno}a /mnt
Xcd /mnt
Xinstall
XEOF
X
Xsync
X
Xecho    "The next step:  reboot from the kernel copy disk, copy a"
Xecho    "kernel to your hard disk (to partition ${drivename}a), then reboot"
Xecho    "from the hard disk."
Xecho    ""
Xecho    "Enter 'halt' to halt the machine."
Xecho    "Once the machine has halted, replace the floppy in the disk drive"
Xecho    "with the kernel-copy disk that you originally booted from."
Xecho    "Once you have done that, press any key to reboot."
END_OF_FILE
if test 10967 -ne `wc -c <'i1-install'`; then
    echo shar: \"'i1-install'\" unpacked with wrong size!
fi
chmod +x 'i1-install'
# end of 'i1-install'
fi
if test -f 'i2-dot_profile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'i2-dot_profile'\"
else
echo shar: Extracting \"'i2-dot_profile'\" \(5510 characters\)
sed "s/^X//" >'i2-dot_profile' <<'END_OF_FILE'
XHOME=/
XPATH=:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:
XTERM=pc3	# terminal emulator, for elvis
XTERMCAP="\
Xpc3|ibmpc3:li#25:co#80:am:bs:bw:eo:cd=\E[J:ce=\E[K:cl=\Ec:cm=\E[%i%2;%2H:\
Xdo=\E[B:ho=\E[;H:nd=\E[C:up=\E[A:so=\E[7m:se=\E[0m:us=\E[4m:ue=\E[0m:\
X:ac=l\332q\304k\277x\263j\331m\300w\302u\264v\301t\303n\305:\
X:kb=^h:kh=\E[Y:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:"
Xexport TERMCAP
Xexport PATH
Xexport TERM
Xexport HOME
Xecho "Congratulations, you've got NetBSD-current on the hard disk!"
Xecho ""
Xecho "To finish installation:"
Xecho "Pick a temporary directory by running set_tmp_dir.  make sure it's"
Xecho "in a place with lots of space, probably under /usr."
Xecho "Then, load the remaining distribution files into that temporary"
Xecho "directory by issuing one of the following commands:"
Xecho "       load_fd"
Xecho "       load_qic_tape"
Xecho "       load_scsi_tape"
Xecho "or by fetching the files with ftp (see the installation notes for"
Xecho "information on how to do that)."
Xecho ""
Xecho "Once this is complete, extract the distribution files by issuing the"
Xecho "command 'extract <distribution>'  where <distribution> is the base name"
Xecho "of the distribution files, e.g. 'nbase08'."
Xecho ""
Xecho "Once all of the filesets you wish to install have been extracted,"
Xecho "enter the command 'configure' to finish setting up the system"
Xecho " "
Xecho "If you should wish to uninstall NetBSD, delete the partition by using the "
Xecho " DOS 5 FDISK program. If installed on the entire drive, use the FDISK/MBR"
Xecho " to remove the NetBSD bootstrap from the drive."
Xecho 'erase ^?, werase ^H, kill ^U, intr ^C'
Xstty newcrt werase ^H intr ^C kill ^U erase '^?' 9600
Xmount -at ufs
Xupdate
Xumask 0
X
Xbeep()
X{
X	echo 'Beep!!!'
X}
X
Xset_tmp_dir()
X{
X	def_tmp_dir=`pwd`
X	if [ "$def_tmp_dir" = "/" ]; then
X		def_tmp_dir=/usr/distrib
X	fi
X	echo -n "what dir should be used for temporary files? [$def_tmp_dir] "
X	read tmp_dir
X	if [ "$tmp_dir" = "" ]; then
X		tmp_dir=$def_tmp_dir
X	fi
X	if [ ! -d "$tmp_dir" ]; then
X		/bin/rm -rf $tmp_dir
X		mkdir -p $tmp_dir
X	fi
X}
Xtmp_dir()
X{
X	if [ "$tmp_dir" = "" ]; then
X		set_tmp_dir
X	fi
X	cd $tmp_dir
X}
Xload_fd()
X{
X	tmp_dir
X	which=
X	while [ "$which" != "a" -a "$which" != "b" ]; do
X		echo -n "read from which floppy drive?  [a or b] "
X		read which
X	done
X	while echo -n "Insert floppy (hit ^C to terminate, enter to load): "
X	do
X		read foo
X		mread "$which:*.*" .
X	done
X}
Xload_qic_tape()
X{
X	tmp_dir
X	echo -n "Insert tape into QIC tape drive and hit return to continue: "
X	read foo
X	tar xvf /dev/rwt0
X}
Xload_scsi_tape()
X{
X	tmp_dir
X	echo -n "Insert tape into SCSI tape drive and hit return to continue: "
X	read foo
X	tar xvf /dev/nrst0
X}
Xextract()
X{
X	tmp_dir
X	echo -n "Would you like to be verbose about this? [n] "
X	read verbose
X	case $verbose in
X		y*|Y*)
X			tarverbose=--verbose
X			;;
X		*)
X			tarverbose=
X			;;
X	esac
X	cat "$@"* | gunzip | (cd / ; tar --extract --file - --unlink --preserve-permissions ${tarverbose} )
X
X	sync
X}
Xconfigure()
X{
X	echo    "You will now be prompted for information about this"
X	echo	"machine.  If you hit return, the default answer (in"
X	echo	"brackets) will be used."
X
X	echo    ""
X	echo -n "What is this machine's hostname? [unknown.host.domain] "
X	read hname
X
X	if [ "$hname" = "" ]; then
X		hname=unknown.host.domain
X	fi
X	echo $hname > /etc/myname
X	proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
X	
X	echo    ""
X	echo    "What domain is this machine in (this is NOT its YP"
X	echo -n "domain name)? [$proto_domain] "
X	read dname
X
X	if [ "$dname" = "" ]; then
X		dname=$proto_domain
X	fi
X
X	cp /etc/sendmail.cf_proto /etc/sendmail.cf
X
X	beep	
X	echo	"WARNING: sendmail will puke on your carpet when the machine"
X	echo	"starts up.  If you don't want it to keep doing this, either"
X	echo	"turn it off in /etc/rc, or give it a reasonable"
X	echo	"/etc/sendmail.cf file."
X
X	echo	"127.0.0.1     localhost" > /etc/hosts
X
X	echo	""
X	echo -n "Does this machine have an ethernet interface? [y] "
X	read resp
X	case "$resp" in
X	        n*)
X                ;;
X        *)
X		intf=
X		while [ "$intf" = "" ]; do
X			echo -n "What is the primary interface name (i.e. ed0, etc.)? "
X			read intf
X		done
X		echo -n "What is the hostname for this interface? [$hname] "
X		read ifname
X		if [ "$ifname" = "" ]; then
X			ifname=$hname
X		fi
X		ifaddr=
X		while [ "$ifaddr" = "" ]; do
X			echo -n "What is the IP address associated with this interface? "
X			read ifaddr
X		done
X		echo "$ifaddr    $ifname `echo $ifname | sed -e s/\.$dname//`" \
X			>> /etc/hosts
X
X		echo -n "Does this interface have a special netmask? [n] "
X		read resp
X		case "$resp" in
X		        y*)
X				echo -n "What is the netmask? [0xffffff00] "
X				read ifnetmask
X				if [ "$ifnetmask" = "" ]; then
X					ifnetmask=0xffffff00
X				fi
X	       		        ;;
X			*)
X				ifnetmask=
X				;;
X		esac
X		
X		echo -n "Does this interface need additional flags? [n] "
X		read resp
X		case "$resp" in
X			y*)
X				echo -n "What flags? [llc0] "
X				read ifflags
X				if [ "$ifflags" = "" ]; then
X					ifflags=llc0
X				fi
X				;;
X			*)
X				ifflags=
X				;;
X		esac
X		
X		echo "inet $ifname $ifnetmask $ifflags" > /etc/hostname.$intf
X
X		beep
X		echo    "WARNING: if you have any more ethernet interfaces, you"
X		echo	"will have to configure them by hand.  Read the comments"
X		echo	"in /etc/netstart to learn how to do this"
X                ;;
X	esac
X
X	sync
X
X	echo	""
X	echo	"OK.  You should be completely set up now."
X	echo	"You should now reboot your machine by issuing the 'reboot' command"
X	echo	"after removing anything that happens to be in your floppy drive."
X}
END_OF_FILE
if test 5510 -ne `wc -c <'i2-dot_profile'`; then
    echo shar: \"'i2-dot_profile'\" unpacked with wrong size!
fi
# end of 'i2-dot_profile'
fi
if test -f 'i2-install' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'i2-install'\"
else
echo shar: Extracting \"'i2-install'\" \(760 characters\)
sed "s/^X//" >'i2-install' <<'END_OF_FILE'
X#!/bin/sh
X# install2.fs disk 'install'
X# Simplified, interactive 386bsd installation script.
X# D.E. Silvia (dsilvia@net.com)
X#
X# Installs balance of basic 386bsd system.
X#
X
Xmount -at ufs
Xbin/rm /.profile
Xecho -n "Verbose installation? [n] "
Xread resp
X
Xecho Copying to disk.
Xcase $resp in
X	y*)
X		tarverbose=v
X		;;
X	*)
X		tarverbose=
X		;;
Xesac
X
Xtar cfp - . | (cd / ; tar xfp${tarverbose} -)
X
Xsync
X
Xecho    "OK.  All of the base files are installed."
Xecho    ""
Xecho    "The next step: reboot from the hard disk, and follow"
Xecho    "more instrutctions."
Xecho    ""
Xecho    "To do this, enter 'halt' at the prompt to halt the machine."
Xecho	"Once the machine has halted, remove the floppy from the disk"
Xecho	"drive, and hit any key to reboot from the hard disk."
END_OF_FILE
if test 760 -ne `wc -c <'i2-install'`; then
    echo shar: \"'i2-install'\" unpacked with wrong size!
fi
chmod +x 'i2-install'
# end of 'i2-install'
fi
echo shar: End of shell archive.
exit 0

------------------------------------------------------------------------------