#
# bootsel.sh    TS-TGL Boot Script for NetBSD
#
# Version:      0.0
#
# chkconfig: S 15 0
#

# USBDETECT=`/bin/dmesg | /bin/grep '^USB Mass Storage device found'`
RC=`/bin/mount -o ro -t vfat /dev/sde1 /mnt/usbdisk1`
echo 'RC: ' $RC
if [ "$RC"x == ""x ]; then
#  /bin/mount -o ro -t vfat /dev/sde1 /mnt/usbdisk1
  if [ -f /mnt/usbdisk1/netbsdboot ]; then
             /bin/echo netbsdboot found.
             /bin/date > /etc/rootfs_ok
             /usr/sbin/miconapl -a boot_end
             /usr/sbin/miconapl -a system_set_watchdog 0
             . /mnt/usbdisk1/netbsdboot
        /bin/sync
        /bin/sync
        /bin/umount -a
        /bin/mount -n -o remount,ro /
        /bin/mount -o ro -t vfat /dev/sde1 /mnt/usbdisk1
        /bin/sleep 2
        /bin/sync
        /bin/sync
        /sbin/insmod /mnt/usbdisk1/$NBLOADER \
                kernel=/mnt/usbdisk1/$NBKERNEL \
                cmdline=bootdev=$NBBOOTDEV
        /bin/mount -n -o remount,rw /
        fi
fi
