X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FDEPLOY.sh;h=80c9f96c44a72bcb51e91cbc38c0514987d1e0dd;hb=4a6b159e05fed37e40d586b938c31a22fe82d3d0;hp=eaec5b3ceb5e48af6eca87fa7c25bd8882861046;hpb=79bd21297c5df234ad210c19956efaa35e4af2ec;p=anna.git diff --git a/example/diameter/launcher/DEPLOY.sh b/example/diameter/launcher/DEPLOY.sh index eaec5b3..80c9f96 100755 --- a/example/diameter/launcher/DEPLOY.sh +++ b/example/diameter/launcher/DEPLOY.sh @@ -7,8 +7,10 @@ SETUPS_DIR=../../../source/diameter/stack/setups MSGDTD=../../../include/anna/diameter/codec/message.dtd DCTDTD=../../../include/anna/diameter/stack/dictionary.dtd BASE_PROT=commands_baseProtocol.xml -EXEC=./debug/example_diameter_launcher -DPATH_dflt=$HOME/ADL + +# Executables in priority order: +EXEC_installed=/opt/bin/anna/example_diameter_launcher +EXECS=( $EXEC_installed ./release/example_diameter_launcher ./debug/example_diameter_launcher ) ############# # FUNCTIONS # @@ -17,9 +19,27 @@ _exit () { echo echo $1 echo - exit + exit 1 } +usage () { + echo "Usage: $0 [deployment_type: a|b|f] [deployment_path]" + echo + echo " deployment_type:" + echo " a=advanced" + echo " b=basic" + echo " f=function test client" + echo " deployment_path:" + echo " non-existent path directory." + echo + echo " For example:" + echo " $0 b $HOME/ADL/basicServer" + echo " $0 b $HOME/ADL/MMSbalancer" + echo " $0 f $HOME/ADL/tester" + echo + exit 0 +} + # $1: deployment type createRunScript () { @@ -77,51 +97,86 @@ echo echo "---------------------------------------" echo "Anna Diameter Launcher (ADL) deployment" echo "---------------------------------------" +[ "$1" = "--help" -o "$1" = "-h" ] && usage +echo " (--help or -h for more info)" echo -echo "Input deployment path [$DPATH_dflt]:" -read DPATH -[ "$DPATH" = "" ] && DPATH=$DPATH_dflt -[ -d $DPATH ] && _exit "The path '$DPATH' already exists. Remove it before continue..." - echo "Basic checkings ..." -[ ! -f $EXEC ] && _exit "Anna Diameter Launcher (ADL) is not linked. Execute 'scons' for 'anna' suite." -[ ! -d $SETUPS_DIR ] && _exit "Diameter stacks not found ($SETUPS_DIR). Perhaps you executed this script out of its parent path." +available= +for EXEC in ${EXECS[@]}; do + echo -n "Looking executable at '$EXEC' ... " + [ -x $EXEC ] && { available=yes ; echo "available !" ; break ; } + echo "not found" +done +[ -z "$available" ] && _exit "Anna Diameter Launcher (ADL) is not installed neither linked. See README.md (Install section)." +[ ! -d $SETUPS_DIR ] && _exit "Diameter stacks not found ($SETUPS_DIR)." echo -echo "Deploy one of these versions:" -echo -echo " (a)dvanced version: includes burst management script and templates for different scenarios. Automatic configuration during start." -echo " (b)asic version: 4 types of launcher (client, server, balancer, dummy), lightly configured and managed through SIGURS2 method." -echo " (f)unction test client: special client with regexp scheduler script based on splitted traffic logs." -echo -echo "Input option [b]:" -read option -[ "$option" = "" ] && option=b +if [ "$1" = "" ] +then + echo + echo "Deploy one of these versions:" + echo + echo " (a)dvanced version: includes burst management script and templates for different scenarios. Automatic configuration during start." + echo " (b)asic version: 4 types of launcher (client, server, balancer, dummy), lightly configured and managed through SIGURS2 method." + echo " (f)unction test client: special client with regexp scheduler script based on splitted traffic logs." + echo + echo "Input option [b]:" + read option + [ "$option" = "" ] && option=b +else + option=$1 +fi + case $option in a) - RESOURCES_DIR=resources/advanced + echo "Advanced deployment" + DEPLOYMENTS_DIR=deployments/advanced + DPATH_dflt=$HOME/ADL-advanced ;; b) - RESOURCES_DIR=resources/basic + echo "Basic deployment" + DEPLOYMENTS_DIR=deployments/basic + DPATH_dflt=$HOME/ADL-basic ;; f) - RESOURCES_DIR=resources/ft-client + echo "FT deployment" + DEPLOYMENTS_DIR=deployments/ft-client + DPATH_dflt=$HOME/ADL-ft-client ;; *) - _exit "Unknown option !!" + _exit "Invalid deployment type '$option' !!" ;; esac -echo "Copying ..." +echo +if [ "$2" = "" ] +then + echo "Input deployment path [$DPATH_dflt]:" + read DPATH + [ "$DPATH" = "" ] && DPATH=$DPATH_dflt +else + DPATH=$2 +fi + +[ -d $DPATH ] && _exit "The installation path '$DPATH' must not exists." + +echo "Copying to '$DPATH' ..." mkdir -p $DPATH mkdir -p $DPATH/stacks mkdir -p $DPATH/DTDs mkdir -p $DPATH/counters -cp $EXEC $DPATH/ADL-launcher -cp -rL $RESOURCES_DIR/* $DPATH +mkdir -p $DPATH/resources +if [ "$EXEC" = "$EXEC_installed" ] +then + ln -s $EXEC_installed $DPATH/ADL-launcher +else + cp $EXEC $DPATH/ADL-launcher +fi +cp -rL $DEPLOYMENTS_DIR/* $DPATH +cp resources/* $DPATH/resources cp $SETUPS_DIR/*xml $DPATH/stacks cp $SETUPS_DIR/*sh $DPATH/stacks cp $SETUPS_DIR/readme.txt $DPATH/stacks