#!/bin/sh
#
# 5799-WZQ (C) COPYRIGHT IBM CORPORATION 1987
# LICENSED MATERIALS - PROPERTY OF IBM
# REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
#
# $Header:apply.update.2 12.0$
# $ACIS:apply.update.2 12.0$
# $Source: /ibm/acis/usr/sys/support/lib/RCS/apply.update.2,v $

#Apply.update step 2; save to-be-modified files on a streaming tape

: ${File?} ${Buffer?} ${LIB?}

cd /

if [ ! -r Tar.list ]
then
	echo "/Tar.list doesn't exist"
	exit 12
fi

if [ ! -s Tar.list ]
then
	echo "This update will not replace any files you have
modified; please continue with Step 3"
	exit 0
fi

echo -n "
This step will save your modified files on a streaming tape
so that you may restore them after applying the update.

If you wish to stop now, type <Ctrl>-C, and restart later
from this point with the command
	apply.update -2 $args

If you wish to save the files listed in /Tar.list yourself,
type <Ctrl>-C, save your files, and restart with the command
	apply.update -3 $args

If you wish to continue, place a blank streaming tape into
the drive, and then press Enter.

Press Enter to continue, <Ctrl>-C to abort:"

read junk

echo -n "
If this is a new streaming tape, it must be retensioned.
Unless you know that the tape has been retensioned, you
should retension it now.

Retension the tape? (y/n): "
while :
do
	read ans
	case $ans in
	[yY]*)	ans=Yes
		break
		;;
	[nN]*)	ans=No
		break
		;;
	*)	echo "Please type y(es) or n(o)"
		echo -n "Retension the tape? (y/n): "
		;;
	esac
done

if [ $ans = Yes ]
then
	echo -n "Retensioning ..."
	mt -f /dev/rst0 retension
	echo " done"
fi

echo -n Saving your files ... 
tar cf /dev/st0 `cat /Tar.list`
echo " done"
echo "
If any error messages were printed above, you must save the
files yourself.  The command used by this program was:
	tar cf /dev/st0 \`cat /Tar.list\`

Contact the Academic Computing Support Center if you need
assistance.  Do not continue with step 3 until you have
saved your files."
exit 0
