#!/bin/csh -f
#
# This is used by the makefile after things have been compiled.
# This should not be used directly.
#

set INSTALLDIR  = `./defs install`
set ALEXSRVR    = `./defs alexsrvr`
set HOSTNAME    = `hostname`

/bin/rm -f     $INSTALLDIR/defs
cp  defs       $INSTALLDIR/defs

if ($1 == basic) then
    echo "updating alexd and alexmountd"
    /bin/rm -f      $INSTALLDIR/alexd 
    /bin/rm -f      $INSTALLDIR/alexmountd
    cp  alexd       $INSTALLDIR 
    cp  alexmountd  $INSTALLDIR 

    foreach SCRIPT (`ls scripts`)
        echo $SCRIPT
        cat scripts/$SCRIPT | sed s/DEFAULTSERVERHOST/${HOSTNAME}/g | sed s-BINDIR-${INSTALLDIR}-g > $INSTALLDIR/$SCRIPT
        chmod +x $INSTALLDIR/$SCRIPT
    end
endif

if ($1 == nonbasic) then
    echo "updating nonbasic"
    /bin/rm -f $INSTALLDIR/alexfsck
    /bin/rm -f $INSTALLDIR/evictor
    /bin/rm -f $INSTALLDIR/printinfo
    cp  alexfsck   $INSTALLDIR
    cp  evictor    $INSTALLDIR
    cp  printinfo  $INSTALLDIR
endif




