
# Alpha Micro make AM-1072 Distribution Tape Command
case $1 in
	rmt* )  echo "\n\nMount the tape on the tape drive."
		echo "Enter carriage return when ready: \c"
		;;
	str* )  echo "\n\nInstall the Boot Tape streamer in the drive."
		echo "Enter a carriage return when ready: \c"
		;;
	* )	echo "\n\nAlpha Micro make AM-1072 Distribution Tape Command\n"
		echo "Usage:	make_1072_tape dev"
		echo "The following devices are currently supported:"
		echo "	rmtD	- Magnetic tape"
		echo "	strD	- Streamer tape"
		echo "	   D = Device number\n\n"
		exit 1
		;;
esac
read jnk
echo "Cleaning up the disk"
cd /usr/adm
rm -f OLD*
echo > cronlog
echo > errfile
rm -f oerrfile
rm -f dtmp
rm -f fee
rm -f pacct
cd /usr/adm/acct/nite
rm -f *
cd /usr/adm/acct/sum
rm -f *
cd /usr/adm/acct/fiscal
rm -f *
cd /usr/adm/sa
rm -f *
cd /install
echo < /dev/$1
dd if=sa_bootx of=tmp$$ ibs=32 skip=1 obs=512
echo "Writing boot program...."
dd if=tmp$$ of=/dev/n$1 bs=512 conv=sync
rm -f tmp$$
echo "Writing AMIX kernel...."
dd if=/unix of=/dev/n$1 bs=512 conv=sync
echo "Writing badblock program...."
dd if=sa_badblk of=/dev/n$1 bs=512 conv=sync
echo "Writing restore program...."
dd if=sa_restore of=/dev/n$1 bs=512 conv=sync
echo "Writing root file system...."
case $1 in
	rmt* )  dd if=fs ibs=512 of=/dev/n$1 obs=512 conv=sync
		;;
	str* )  dd if=fs ibs=512 of=/dev/n$1 obs=10240 conv=sync
		;;
esac
case $1 in
	rmt* ) ;;
	str* ) # now make sure we can read boot streamer tape
		echo < /dev/$1
		echo "Reading boot program...."
		dd if=/dev/n$1 of=/dev/null bs=512
		echo "Reading AMIX kernel...."
		dd if=/dev/n$1 of=/dev/null bs=512
		echo "Reading badblock program...."
		dd if=/dev/n$1 of=/dev/null bs=512
		echo "Reading restore program...."
		dd if=/dev/n$1 of=/dev/null bs=512
		echo "Reading root file system...."
		dd if=/dev/n$1 of=/dev/null bs=10240
		echo < /dev/$1
		echo "\nInsert the File System streamer tape into the drive."
		echo "Enter a carriage return when ready: \c"
		read jnk
		;;
esac
cd /
tar -cvbf 20 /dev/$1 .
case $1 in
	str* ) ;;
	rmt* ) # now make sure we can read boot mag tape
		echo < /dev/$1
		echo "Reading boot program...."
		dd if=/dev/n$1 of=/dev/null bs=512
		echo "Reading AMIX kernel...."
		dd if=/dev/n$1 of=/dev/null bs=512
		echo "Reading badblock program...."
		dd if=/dev/n$1 of=/dev/null bs=512
		echo "Reading restore program...."
		dd if=/dev/n$1 of=/dev/null bs=512
		echo "Reading root file system...."
		dd if=/dev/n$1 of=/dev/null bs=512
		;;
esac
echo "Reading file system...."
dd if=/dev/n$1 of=/dev/null bs=10240
echo < /dev/$1
echo  "\n\nAM-1072 Distribution Tapes Completed\n"

