Listing 3: Restore shell script; mypreinst
#!/bin/sh
# This is an example script to restore an IRIX system from a backup tape
# Requires Following Environment Variables Set by RoboInst
# SGI_CUSTOM Dir for which mrconfig from server is located
# SGI_ROOT Dir for root on client, ie $SGI_ROOT/ or $SGI_ROOT/root
# Define hn and hostname
hn=`nvram hostname`
hostname $hn
# Section 1: Install Netbackup to miniroot at /$SGI_ROOT/mr/usr
#
echo "Creating /usr/openv for Backup"
ln -s $SGI_ROOT/mr/usr/openv /usr/openv
mkdir -p $SGI_ROOT/mr/usr/openv
cd /usr/openv
$SGI_CUSTOM/StandardFiles/zcat $SGI_CUSTOM/StandardFiles/netbackup.tar.Z \
| $SGI_CUSTOM/StandardFiles/tar xf -
echo "s/HOSTNAME/$hn/g" > /tmp/hosts.sed
cd netbackup
mv bp.conf bp.conf.orig
sed -f /tmp/hosts.sed $SGI_CUSTOM/StandardFiles/bp.conf.sed > bp.conf
echo "Removing $SGI_CUSTOM/StandardFiles/netbackup.tar.Z to conserve space"
/sbin/rm -f $SGI_CUSTOM/StandardFiles/netbackup.tar.Z
# Section 2: Install Standard services and network tools
#
cd $SGI_CUSTOM/StandardFiles
cp services inetd.conf /etc
cp inetd /usr/etc
cp more /sbin
cd /etc ; chown root services inetd.conf
cd /usr/etc ; chown root inetd
chmod +x inetd
cd /sbin ; chown root more
chmod +x more
/usr/etc/inetd &
# Section 3: Restore System disk from tape
#
renFile="/usr/openv/netbackup/renameFile.txt"
echo "change / to $SGI_ROOT" > $renFile
cd /usr/openv/netbackup
echo "Restore command is:"
echo " /usr/openv/netbackup/bin/bprestore -B -w -R $renFile -C $hn /"
/usr/openv/netbackup/bin/bprestore -B -w -R $renFile -C $hn /
echo
echo end of $SGI_CUSTOM/mypreinst script
|