#!/bin/sh
#
# $Header: /r/cvs/FASware/files/install_netapp,v 3.4 1997/01/15 00:53:04 rmg Exp $
#
# Copyright (c) 1996-1997 Network Appliance, Inc.
# All rights reserved.
#

#  Die on any failure.
#
set -e

#  We won't even rely on basename being around!
#
MYNAME=install_netapp

if [ $# -ne 1 ]
  then echo "usage: $MYNAME <dest_dir>"; exit 1; fi

DEST="$1";

if [ ! -d "$DEST" ]
  then echo "$MYNAME: \"$DEST\" is not a directory."; exit 1; fi

if [ ! -w "$DEST" ]
  then echo "$MYNAME: \"$DEST\" is not writable."; exit 1; fi

UNCOMPRESS="${UNCOMPRESS:=uncompress}"
UNCOMPRESSOPTS="${UNCOMPRESSOPTS:=}"

PATH="$PATH:/bin:/usr/bin:/usr/ucb"

echo "$MYNAME: $UNCOMPRESS $UNCOMPRESSOPTS tar_image.Z"
$UNCOMPRESS $UNCOMPRESSOPTS tar_image.Z

here=`/bin/pwd`

TAR="${TAR:=tar}"

echo "$MYNAME: cd \"$DEST\""
cd "$DEST"

echo "$MYNAME: rm -f etc/boot/netapp-x86 etc/boot/netapp-alpha"
rm -f etc/boot/netapp-x86 etc/boot/netapp-alpha

echo "$MYNAME: $TAR xvf \"$here/tar_image\""
$TAR xvf "$here/tar_image"

echo "$MYNAME: cd \"$here\"; rm -rf tar_image $MYNAME"
cd $here; rm -f tar_image $MYNAME

exit 0
