From b8d9d3d86c425cf545bbee4fa48522157a55c3bd Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Sat, 28 Mar 2015 17:37:26 +0100 Subject: [PATCH] Improve deployments and installation procedures --- README.md | 9 +++-- SConstruct | 17 +++++---- example/diameter/launcher/DEPLOY.sh | 20 +++++++++-- .../launcher/deployments/basic/configure.sh | 36 ++++++++++++++----- example/postinstall.sh | 36 +++++++++++++++++++ 5 files changed, 97 insertions(+), 21 deletions(-) create mode 100755 example/postinstall.sh diff --git a/README.md b/README.md index 8411958..1b95114 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,15 @@ Execute 'scons example' to generate example binaries ## Install -Execute 'scons install' -(install-include-and-lib and install-example, are another aliases for selective installation) +Execute 'sudo scons install-include' for only headers +Execute 'sudo scons install-lib' for only libraries +Execute 'sudo scons install-include-and-lib' for headers & libraries +Execute 'sudo scons install-example' for only example binaries/resources +Execute 'sudo scons install' to install the whole suite ## Uninstall -Execute 'scons uninstall' +Execute 'sudo scons uninstall' diff --git a/SConstruct b/SConstruct index 517b1a6..e80caf4 100644 --- a/SConstruct +++ b/SConstruct @@ -145,12 +145,13 @@ env.Default (test_unit_list) # only modified files: env.Alias('doc', env.Command('doc.dummy', [], 'cd docs/doxygen; doxygen')) +# Installation aliases: # -# Run 'sudo scons install' to install the suite: -# -# 'sudo scons install-include' for only headers -# 'sudo scons install-lib' for only libraries -# 'sudo scons install-bin' for only binaries +# 'sudo scons install-include' for only headers +# 'sudo scons install-lib' for only libraries +# 'sudo scons install-include-and-lib' for headers & libraries +# 'sudo scons install-example' for only example binaries/resources +# 'sudo scons install' to install the whole suite # # Run 'sudo scons uninstall' to uninstall the suite # @@ -158,13 +159,17 @@ env.Alias('doc', env.Command('doc.dummy', [], 'cd docs/doxygen; doxygen')) install_include = env.Install (target_usr_local_include, Glob("include/anna/*")) install_lib = env.Install (target_usr_local_lib, Glob("source/*/" + variant + "/*.a")) install_example = env.Install (target_opt_bin, Glob("example/*/*/" + variant + "/example_*")) +postinstall_example = env.Command('./example/postinstall.out', None, './example/postinstall.sh') + #Default ('install') Depends (install_include, test_unit_result) Depends (install_lib, test_unit_result) Depends (install_example, test_unit_result) +ii = env.Alias('install-include', [target_usr_local_include]) +il = env.Alias('install-lib', [target_usr_local_lib]) iil = env.Alias('install-include-and-lib', [target_usr_local_include, target_usr_local_lib]) -iex = env.Alias('install-example', target_opt_bin) +iex = env.Alias('install-example', [target_opt_bin, postinstall_example]) env.Alias('install', [iil, iex]) env.Command ("uninstall", None, [ Delete(target_usr_local_include), Delete(target_usr_local_lib), Delete(target_opt_bin) ]) diff --git a/example/diameter/launcher/DEPLOY.sh b/example/diameter/launcher/DEPLOY.sh index 76ccd8b..7f53a99 100755 --- a/example/diameter/launcher/DEPLOY.sh +++ b/example/diameter/launcher/DEPLOY.sh @@ -7,7 +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 + +# Executables in priority order: +EXEC_installed=/opt/bin/anna/example_diameter_launcher +EXECS=( $EXEC_installed ./release/example_diameter_launcher ./debug/example_diameter_launcher ) ############# # FUNCTIONS # @@ -78,7 +81,13 @@ echo "Anna Diameter Launcher (ADL) deployment" echo "---------------------------------------" echo echo "Basic checkings ..." -[ ! -f $EXEC ] && _exit "Anna Diameter Launcher (ADL) is not linked. Execute 'scons' for 'anna' suite." +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 @@ -124,7 +133,12 @@ mkdir -p $DPATH/stacks mkdir -p $DPATH/DTDs mkdir -p $DPATH/counters mkdir -p $DPATH/resources -cp $EXEC $DPATH/ADL-launcher +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 diff --git a/example/diameter/launcher/deployments/basic/configure.sh b/example/diameter/launcher/deployments/basic/configure.sh index a5d1515..c377a13 100755 --- a/example/diameter/launcher/deployments/basic/configure.sh +++ b/example/diameter/launcher/deployments/basic/configure.sh @@ -8,10 +8,6 @@ STD_DICTIONARY=stacks/avps_etsi.xml,stacks/avps_ietf.xml,stacks/avps_tgpp.xml,stacks/commands_baseProtocol.xml APP_DICTIONARY=stacks/commands_qosControl.xml DICTIONARY=$STD_DICTIONARY,$APP_DICTIONARY -# Perhaps the stack is not fully defined: -#KINDNESS=-ignoreErrors -# But we prefer stack to generate Failed-AVP automatically: -KINDNESS= # Communication endpoints: LOCAL_STANDARD_ENDPOINT=localhost:3868 @@ -21,11 +17,6 @@ CONNS=10 # General EXE_BN=ADL-launcher -# Tracing: -TRACING="-cntDir counters" -# need detailed traces ?: -#TRACING="$TRACING -trace debug" - ############# # FUNCTIONS # ############# @@ -77,6 +68,32 @@ read option tol=$(get_tol $option) [ "$tol" = "" ] && _exit "Option '$option' not implemented !!" +# Tracing +TRACING="-cntDir counters" +echo +echo "Enable debug traces ? (y/n) [n]:" +read enable +[ "$enable" = "" ] && enable=n +[ "$enable" = "y" ] && TRACING="$TRACING -trace debug" + +# Kindness +KINDNESS= +echo +echo "Strict xml for decoded messages ? (y/n) [y]:" +echo " (ignoring flags turns a made-up xml representation; execute './$EXE_BN | grep -A1 ignoreFlags:' for more help)" +read strict +[ "$strict" = "" ] && strict=y +[ "$strict" = "n" ] && KINDNESS="-ignoreFlags" +if [ "$option" = "s" ] +then + echo + echo "Ignore errors ? (y/n) [n]:" + echo " (ignoring errors, the process won't answer Failed-AVP automatically; execute './$EXE_BN | grep -A1 ignoreErrors:' for more help)" + read i_errors + [ "$i_errors" = "" ] && i_errors=n + [ "$i_errors" = "y" ] && KINDNESS="$KINDNESS -ignoreErrors" +fi + # Run script: EXE_LINK=ADL-$tol ln -sf $EXE_BN $EXE_LINK @@ -105,5 +122,6 @@ case $tol in esac +echo echo "Created 'run.sh' script !" echo diff --git a/example/postinstall.sh b/example/postinstall.sh new file mode 100755 index 0000000..48470ff --- /dev/null +++ b/example/postinstall.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +cd `dirname $0` + +cat << EOF + +=========================== [483/19225] +Post-installation procedure +=========================== + +This will preconfigure examples when proceed. + +You can also execute this procedure later by mean: + + 1) scons install: no sudo required again once installed and perhaps + you prefer deployments with another unix user. + + 2) Executing './example/postinstall.sh' + + +Press ENTER to continue, CTRL+C to abort ... +EOF + +read + +# diameter module +./diameter/launcher/DEPLOY.sh + +# ... +# ... + +# perhaps the user wants to redeploy ... +#touch `basename $0 .sh`.out + +exit 0 + -- 2.20.1