#!/bin/sh
#
#	usage: writeboot <boot_file> <boot_device(raw)>
#

temp=/tmp/writeboot$$

case "$#" in
 2)	;;
 *)	echo "usage: `basename $0` fdboot /dev/rfd?a"	>&2
	exit 1;;
esac

trap "rm -f $temp; exit 1" 1 2 3 15
rm -f $temp
(	dd if=$1 bs=64 count=1
	dd if=$2 bs=1024 count=1 | dd bs=64 skip=1 count=7
	dd if=$1 bs=256 skip=2	) > $temp

cat $temp /dev/zero | dd bs=1024 count=4 of=$2
rm -f $temp
