#!/bin/csh -f
#
# unpksa machine destinationdir
#
# unpacks the stuff needed for a stand-alone renderer
# run this script as user 'gig'!


if ( -x /bin/tar ) then
  set tarrer = /bin/tar
endif
if ( -x /usr/bin/tar ) then
  set tarrer = /usr/bin/tar
endif
if ( -x /bin/cat ) then
  set catter = /bin/cat
endif
if ( -x  /usr/bin/cat ) then
  set catter = /usr/bin/cat
endif

set gentarfile = `pwd`/../archives/gig.tar
set genidxfile = `pwd`/../archives/gig.sa

if ( $1 == sgi ) then
  set tarfile = `pwd`/../archives/sgigig.tar
  set idxfile = `pwd`/../archives/sgigig.sa
endif

if ( $1 == intel86 ) then
  set tarfile = `pwd`/../archives/linuxgig.tar
  set idxfile = `pwd`/../archives/linuxgig.sa
endif

if ( $1 == sun ) then
  set tarfile = `pwd`/../archives/sungig.tar
  set idxfile = `pwd`/../archives/sungig.sa
endif

if ( $1 == hp ) then
  set tarfile = `pwd`/../archives/hpgig.tar
  set idxfile = `pwd`/../archives/hpgig.sa
endif

if (! $?tarfile ) then
  echo Unknown machine type: $1
  exit 1
endif
if (! $?catter ) then
  echo program cat not found in /bin or /usr/bin
endif
if (! $?tarrer ) then
  echo program tar not found in /bin or /usr/bin
endif

cd $2

$tarrer xvf $tarfile `$catter $idxfile` |& $catter

$tarrer xvf $gentarfile `$catter $genidxfile` |& $catter

