#
# Shell script to copy IBM installation tapes to the hard drive for
# tape duplication
#
# Ensure that block_size is 0
#
# John Roebuck - 20/11/98
#

if [ $# != 2 ]
   then echo " "
        echo "Usage : tape-copy device directory"
        echo " "
        echo "E.G.  : tape-copy rmt0 /home/john"
        echo " "
        exit
fi

tctl -f /dev/$1 rewind

norewind="/dev/"$1".1"
c=0
true=0
okay=0

while true=0
do
	c=`expr $c + 1`	
	filename=$2/tape$c
	echo "Copying file number - $c"
	dd if=$norewind of=$filename 

	if test $? -eq $okay
	then okay=0
        else echo "Done"
             echo " "
             exit
	fi

done

