#!/bin/ksh
#
#	Shell day restore routine
#
#	by john quirk
#	Version 1.0
#
#	This program restores the day save tape 
#
if [ `puid` != 0 ]
	then
	echo Must be Admin to use this program 
	exit
fi
echo 'Is the day save tape you wish to restore inserted ?'
read input
if test -z "$input"
	then exit
fi
if [ $input = "y" ]
	then
	echo 'Rewinding Tape'
	echo 'Do you wish select files to be restored'
	read input
	if [ $input != "n" ]
	then
		iostats -rewind /dev/rcs0 2>/dev/null
		installation -t bs=2000b -x /dev/rcs0 >/tmp/tempx.$$
		print_file </tmp/tempx.$$ | pick | translit "\n" " " >/tmp/tempx1.$$
	fi
fi
echo "Do you wish to continue with restore ?"
read input
if test ! -z "$input"
	then
	if [ $input = "y" ]
		then
		echo starting restore....
		iostats -rewind /dev/rcs0 2>/dev/null
		installation bs=2000b -x /dev/rcs0 `cat /tmp/tempx1.$$ 2>/dev/null`
		iostats -rewind /dev/rcs0 2>/dev/null
	fi
#
# Cleanup the files
#
fi
delete /tmp/temp*$$ 2>/dev/null
