#tape-restore
#
# Restore the tape files back to a tape.
# 2nd part of the copy IBM installation tape routine.
#
# Ensure that the block_size of the tape device is 0
#
# John Roebuck 19/11/98
#

if [ $# != 2 ]
   then echo " "
        echo "Usage : tape-restore device directory"
        echo " "
        echo "E.G.  : tape-restore rmt0 /home/john"
        echo " "
        exit
fi

tctl -f /dev/$1 rewind

norewind="/dev/"$1".1"
c=0
true=0
okay=0

while true=1
do
	c=`expr $c + 1`	
	filename=$2/tape$c

if test -f $filename
then
        echo "Restoring file number - $c"
	dd of=$norewind if=$filename 
else
	echo "Done"
	echo " "
	exit
fi

done
