#!/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.4 12.0$
# $ACIS:apply.update.4 12.0$
# $Source: /ibm/acis/usr/sys/support/lib/RCS/apply.update.4,v $

#Apply.update step 4; restore files that were saved in step 2

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

saved=/sys/support/Saved

cd /

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

if [ ! -s Tar.list ]
then
	echo "
No files were saved in step 2, so there are no files to be
restored.  The Update is complete."
	rm -rf Tar.list
	exit 4
fi

echo -n "
This step will assist you in restoring your modified files
if you saved them on streaming tape in step 2.  If you saved
them yourself, you will have to restore them yourself, but
you may still find the following explanation useful.
(Press Enter for more)"

read junk

echo -n "
This step will read the files that were saved in step 2 into
$saved and various subdirectories thereof.  (Any
previous contents of $saved will be removed.)

You will have to determine, on a case-by-case basis, if
these files should replace the ones that were installed by
the System Update procedure.  Some files (for example,
/etc/passwd) can simply be copied into place.  Other files
(for example, /etc/termcap) must be merged into the
distributed versions by hand.  Kernel and utility source
will require careful scrutiny to determine if any
locally-applied changes should be merged into the
distributed code.  Refer to the documentation and source
code before arbitrarily overwriting a file.

See the Program Directory that was supplied with the System
Update for more information about changed files.  You may
also contact the Academic Computing Support Center at their
toll-free number 800-642-2272 (in California, 800-443-2272)
for assistance.
(Press Enter for more)"

read junk

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

If you wish to continue, place the streaming tape from step
2 into the drive, and press Enter.

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

read junk

if [ -d $saved ]
then
	echo -n "Removing previous contents of $saved ..."
	rm -rf $saved
	echo " done"
fi

mkdir $saved
cd $saved

echo -n Restoring your files into $saved ...
dd if=/dev/rst0 bs=128k 2>/dev/null | tar xf - .
echo " done"

echo "
The automatic portion of the System Update procedure is now
complete.  You will have to examine the files in
$saved to determine which files should replace,
or be merged with, the distributed files."

rm -rf Tar.list
exit 4
