KBYTES=851

if test -c /dev/rfd0 ; then
    fdn=0
elif test -c /dev/rfd1 ; then
    fdn=1
else
    echo -e "sysadmin: can't find floppy drive"
    exit 1
fi

while (true) ; do
    cat <<!
		File System Maintenance
		-----------------------

	Type	1  to do daily backup,
		2  to do a periodic backup,
		3  to get a backup listing,
		4  to restore a file,
		q  to quit


!
    echo -n "Enter Number: "
    read reply
    case $reply in
	1)
	    echo "DAILY BACKUP"
	    echo -n "Insert first disk in drive $fdn, then press ENTER  "
	    read dummy
	    dump u9fk /dev/rfd$fdn $KBYTES /dev/rroot;
	    exit 0
	    ;;
	2)
	    echo "PERIODIC BACKUP"
	    echo -n "Insert first disk in drive $fdn, then press ENTER  "
	    read dummy
	    dump u0fk /dev/rfd$fdn $KBYTES /dev/rroot
	    exit 0
	    ;;
	3)
	    echo "PRODUCE BACKUP LISTING"
	    echo -n "Insert first disk in drive $fdn, then press ENTER  "
	    read dummy
	    dumpdir f /dev/rfd$fdn >/tmp/backup.list
	    echo "LIST IS IN /tmp/backup.list"
	    exit 0
	    ;;
	4)
	    echo "RESTORE FILE(S)"
	    echo "Type Full Pathname of Files to Restore."
	    echo "One per line, blank line to terminate."
	    while (true) ; do
		echo -n "Enter Pathname: "
		read next
		if [ $next ] ; then
		    path="$path $next"
		else
		    break
		fi
	    done
	    echo -n "Insert first disk in drive $fdn, then press ENTER  "
	    read dummy
	    restor fx /dev/rfd$fdn $path
	    exit 0
	    ;;
	q)
	    exit 0
	    ;;
	*)
	    echo
	    echo "Bad Option -- Try Again"
	    echo
    esac
done
