#!/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`
set CACHEDIRVAR  = `./defs cachedir`
set ALEXSRVRHOME = `./defs home`
set ALEXPATH     = `./defs alexpath`

/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 | sed s-DEFAULTMPOINT-${ALEXPATH}-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
    /bin/rm -f $CACHEDIRVAR/README
    cp  $ALEXSRVRHOME/doc/README.TOP $CACHEDIRVAR/README
endif



