|
|
DataMuseum.dkPresents historical artifacts from the history of: Regnecentalen RC-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Regnecentalen RC-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T u
Length: 5031 (0x13a7)
Types: TextFile
Names: »usr/admin/menu/filemgmt/restore «
└─⟦3d8f416b2⟧ Bits:30004042/core2.imd SW95705I 386/ix Multi-user Release 1.2
└─⟦this⟧ »usr/admin/menu/filemgmt/restore «
#ident "@(#)sadmin:admin/menu/filemgmt/restore 2.9"
#menu# restore files from "backup" & "store" media to built-in disk
#help#
#help# Restore copies files from media made by "backup" and "store"
#help# back onto the file systems. You can restore individual files,
#help# directories of files, or the entire contents of the media.
#help# You can restore from both "incremental" and "complete" media.
#help# You can also list the names of files stored on the media.
flags="-qq -k$$"
trap 'exit 0' 1 2 15
trap ' trap "" 1 2
rm -f /tmp/$$restoreall' 0
rnamewarn='WARNING:
Be very careful when you rename a file. Files incorrectly named
by typing errors are difficult to find and repair.
Remember that only the first 14 characters of each part of the
file name (i.e. the characters between the "/"s) are significant.
You will be asked to rename each file in turn. An empty response skips that
file. An answer of "." (period) restores the file with its original name.'
dir=${0}.d
if [ -d ${dir} ]
then
patterns=`ls ${dir} 2>/dev/null`
else
patterns=
fi
ncpiocmd=ncpio
ncpioargs=
ddrive=`selectdevice -c $$ /dev/rSA ${patterns}`
ndrive=`drivename ${ddrive}`
if [ -n "${patterns}" ]
then
. ${dir}/`selpattern ${ddrive}`
fi
cd /
while true
do
type=`checklist ${flags} -fe -H'
Option 1 restores only the individual files selected.
Option 2 restores all files AND directories below the directory
that you specify.
Option 3 restores every file from the media.
Option 4 list the file names from the media without restoring them.
REMEMBER- If you do not rename a file, "restore" will write over any
copies of files that are presently on the file systems. Also, you MUST
use a full path name when renaming files.' \
'Select:
1. restore single files
2. restore directories of files
3. restore all files
4. list all the files
Enter a number [?, q]:' 1 2 3 4`
rflag=
l=`disklabel -n "${ndrive}" $$ ${ddrive}`
if dd if=${ddrive} of=/tmp/$$restoreall count=2 2>/dev/null
then
if file /tmp/$$restoreall |
grep 'ASCII cpio archive' >/dev/null
then
case "${type}" in
1 ) # single file
sfile=`checkre ${flags} -fe -l ' ' -H '
You may also specify the file names as cpio(1) patterns and you
may specify more than one file name.
If you do not find files that you expect to find, use Option 4 to
list out all the file names on the media. Entering file names
exactly as they exist on the list will always work.' \
'Enter full path name of file(s) to be restored [?, q]:
' \
'.' ' ' \
'^[^ ; ][^ ; ]*$' 'Blanks or tabs not permitted in the file name.' \
'^/' 'A full path name must begin with "/".' \
'[^/]$' 'No trailing "/" in the file name.' \
'/[^/]\{1,14\}$' 'No more than 14 characters in a file name.' |
sed "/./s;.*;'&';" |
tr '\012' ' '`
if checkyn ${flags} -f 'Do you want to rename each file as it is copied in?'
then
echo "${rnamewarn}"
rflag=-r
else
rflag=-v
fi
# Magic here! We must keep the shell from
# interpreting meta-characters that may be in
# ${sfile}.
eval ${ncpiocmd} ${ncpioargs} \
-icdu ${rflag} -I${ddrive} "${sfile}"
;;
2 ) # a directory
sfile=`checkre ${flags} -fe -l ' ' \
'Enter full path name of directory(s) to be restored [q]:
' \
'.' ' ' \
'^[^ ; ][^ ; ]*$' 'Blanks or tabs not permitted in the file name.' \
'^/' 'A full path name must begin with "/".' \
'[^/]$' 'No trailing "/" in the file name.' \
'/[^/]\{1,14\}$' 'No more than 14 characters in a file name.' |
sed "/./s;.*;'&/*';" |
tr '\012' ' '`
if checkyn ${flags} -f 'Do you want to rename each file as it is copied in?'
then
echo "${rnamewarn}"
rflag=-r
else
rflag=-v
fi
# Magic here! We must keep the shell from
# interpreting meta-characters that may be in
# ${sfile}.
eval ${ncpiocmd} ${ncpioargs} \
-icdu ${rflag} -I${ddrive} "${sfile}"
;;
3 ) # entire contents
if checkyn ${flags} -f 'Do you want to rename the files as they are copied in?'
then
echo "${rnamewarn}"
rflag=-r
else
rflag=-V
fi
${ncpiocmd} ${ncpioargs} \
-icdu ${rflag} -I${ddrive}
;;
4 ) # list contents
if checkyn -f 'Do you want to see the file status information, too?'
then
rflag=-v
echo '
mode owner size date of last access filename
------ ------ ----- -------------------- --------------------'
fi
${ncpiocmd} ${ncpioargs} \
-ict ${rflag} -I${ddrive}
echo "You may now remove the medium from the ${ndrive}.▶07◀"
continue
esac
if [ $? = 0 ]
then
echo 'Restoration complete.'
else
echo ' Restoration did not work.
See the Owner/Operator manual for help.'
exit
fi
echo "You may now remove the medium from the ${ndrive}.▶07◀"
continue
fi
echo 'This medium is not a "backup" medium or it is
not the first part in a series. Try again.▶07◀'
else
echo "Unable to read medium in the ${ndrive}. Reinsert and try again.▶07◀"
fi
done