#! /sbin/sh
#Tag 0x00000f00

# Check for devices that should exist after a reboot; to catch
# devices installed (or removed) since the last system boot.
# Must follow autoconfig, as the devices may have loadable drivers.
# "$Revision: 1.4 $"

case "$1" in
  'start')
	cd /dev
	# we always do this now, so that all the tape devices get made, automatically
	# not just the first one on the system.  It also removes any tape 
	# devices that are no longer present.  Tape devices that are OK aren't modified
	./MAKEDEV tape 2>&1 | logger -t MAKEDEV_tape &

	# same for floppies, since we now make /dev/rdsk/fds* only for
	# actually installed floppies.
	hinv -c disk | ( IFS="$IFS:" ; while read d dr s r m u targ o s c ctlr rest; do 
	if [ "$d" = Disk -a "$dr" = drive -a "$r" = removable -a "$m" = media -a "$s" = SCSI ] ; then
		if [ ! -c /dev/rdsk/fds${ctlr}d${targ}.3.5 ] ; then
			echo Creating floppy devices
			./MAKEDEV fds  2>&1 | logger -t MAKEDEV_fds &
			break
		fi
	fi
	done )

	# if a diskless inst is done, we need to make audio devices here
	# since kdsp is loadable now and does not show up in hinv when
	# MAKEDEV is run out of /etc/bcheckrc after a diskless inst.
	# no use of logger or backgrounding on this one, since so fast.
	case "`hinv -c audio`" {
	*Audio*) if [ ! -c /dev/hdsp/hdsp0control ] ; then
			echo Creating audio devices
			./MAKEDEV hdsp
		fi
		;;
	}
	;;

  'stop') # nothing to do on stop
	;;

  *)
	echo "usage: $0 {start|stop}"
	;;
esac
