#! /bin/sh

name=`readlink -fn $0`
BD=`dirname $name`
if [ x$1 != x ]; then
    DST=$1
    mkdir -p $DST
    ZIP=`ls $BD/../../org-lsst-ccs-drivers-auxelex-*-dist.zip`
    REL=`basename $ZIP -dist.zip`
    rm -r $DST/$REL
    unzip -d $DST $ZIP
else
    DST=$BD/../..
    REL=`basename \`dirname $BD\``
fi

mkdir -p $DST/etc
mkdir -p $DST/bin
BS=../$REL/bin/CCSbootstrap.sh
APP=$DST/bin/TestSrp; rm -f $APP; ln -sf $BS $APP
APP=$DST/bin/TestRebPS; rm -f $APP; ln -sf $BS $APP
APP=$DST/bin/TestBfr; rm -f $APP; ln -sf $BS $APP
APP=$DST/bin/TestPdu5V; rm -f $APP; ln -sf $BS $APP
APP=$DST/bin/TestPdu24VC; rm -f $APP; ln -sf $BS $APP
APP=$DST/bin/TestPdu24VD; rm -f $APP; ln -sf $BS $APP
APP=$DST/bin/TestPdu48V; rm -f $APP; ln -sf $BS $APP
APP=$DST/bin/TestIonPump; rm -f $APP; ln -sf $BS $APP
APP=$DST/bin/TestRebBulkPS; rm -f $APP; ln -sf $BS $APP
APP=$DST/bin/TestHeaterPS; rm -f $APP; ln -sf $BS $APP
