#!/bin/rc -x

# replace FILESERVER with the name of your file server
# here we start with kfs, your local disk file system
fileserver=kfs
# replace CPU with the name of your cpu server
cpu=CPU
# replace FACEDOM with the local domain to be used in the faces database
facedom=FACEDOM

# cs sets sysname
ndb/cs
sysname=`{cat /dev/sysname}

# mount mail uncached
mount -c /srv/boot /n/termrc.tmp
bind -c /n/termrc.tmp/mail /mail
unmount /n/termrc.tmp

# start ethernet if any; ignore errors
ip/ipconfig >/dev/null >[2=1]

ndb/dns -r
aux/timesync -rL

switch($terminal){
case carrera*
	bind -a '#t' /dev
case *' ss'*
	/bin/bind -a '#w' /dev >/dev/null >[2=1]
	/bin/bind -a '#t' /dev >/dev/null >[2=1]
case *' magnum'*
	/bin/bind -a '#m' /dev >/dev/null >[2=1]
	/bin/bind -a '#t' /dev >/dev/null >[2=1]
	aux/mouse -dC 0
case *' indigo'*
	/bin/bind -a '#L' /dev >/dev/null >[2=1]
	/bin/bind -a '#w1' /dev >/dev/null >[2=1]
	/bin/bind -a '#t' /dev >/dev/null >[2=1]
	/bin/bind -a '#A' /dev >/dev/null >[2=1]
case NCR* 'AT&TNSX'* generic* _MP_* 'alpha apc'*
	for(i in f t m L S)
		/bin/bind -a '#'^$i /dev >/dev/null >[2=1]
	for(disk in /dev/sd??) {
		if(test -f $disk/data && test -f $disk/ctl)
			disk/fdisk -p $disk/data >$disk/ctl
		for(part in $disk/plan9*)
			if(test -f $part)
				disk/prep -p $part >$disk/ctl >[2]/dev/null
	}
	if(test -f /dev/mousectl){
		switch($mouseport){
		case ps2 ps2intellimouse 0 1 2
			aux/mouse $mouseport

			# parse vgasize into fields
			vgasize=`{echo $vgasize}

			if(! ~ $monitor '' && ! ~ `{cat /dev/user} none){
				aux/vga -l $vgasize
				# turn off hardware acceleration until you know it's ok.
				echo -n 'hwaccel off' >'#v/vgactl' >[2]/dev/null
			}
		}
	}
	if(test -f /dev/sd*/swap){
		x=(`{echo /dev/sd*/swap})
		swap $x(1) >/dev/null >[2=1]
	}
	if(test -f /dev/sd*/dos*){
		dossrv
		c:
	}
}

