From 122ba50424fc9f659834d6186d1279a31e73c096 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Wed, 25 Nov 2015 18:38:47 +0100 Subject: [PATCH] Automate script --- example/diameter/launcher/DEPLOY_setups.sh | 65 ++++++++++++++-------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/example/diameter/launcher/DEPLOY_setups.sh b/example/diameter/launcher/DEPLOY_setups.sh index fe89053..3483c9f 100755 --- a/example/diameter/launcher/DEPLOY_setups.sh +++ b/example/diameter/launcher/DEPLOY_setups.sh @@ -18,26 +18,44 @@ _exit() { ############# # EXECUTION # ############# +type=$1 +target=$2 + +echo +echo " ----------------------------" +echo " SETUPS DEPLOYMENT AUTOMATION" +echo " ----------------------------" +echo +echo "-----------------------------------------------------------" +echo "Usage: $0 [type] [target_directory]" +echo +echo " type:" +echo " 1. Client and server" +echo " 2. Ft-client and server" +echo " 3. St-client and servers" echo -echo "Which one you want to deploy [1]:" +echo " target_directory:" echo -echo " 1. Client and server" -echo " 2. Ft-client and server" -echo " 3. St-client and servers" +echo " Non existing directory to install the stuff" echo -read type +echo "-----------------------------------------------------------" +echo +[ "$type" = "" ] && { echo "Which one you want to deploy [1]:" ; read type ; } [ "$type" = "" ] && type=1 case $type in 1) + echo "Selected Client-Server" DEPLOY_DIR__dflt=$HOME/ADML-clientAndServer ;; 2) + echo "Selected Client-Server FT" DEPLOY_DIR__dflt=$HOME/ADML-ftclientAndServer ;; 3) + echo "Selected Client-Servers ST" DEPLOY_DIR__dflt=$HOME/ADML-stclientAndServers ;; @@ -46,41 +64,42 @@ case $type in exit 1 ;; esac - echo -echo "Directory for deploy [$DEPLOY_DIR__dflt]:" -read DIR -[ "$DIR" = "" ] && DIR=$DEPLOY_DIR__dflt -[ -d $DIR ] && _exit "The directory '$DIR' already exists !" + + +[ "$target" = "" ] && { echo "Directory for deploy [$DEPLOY_DIR__dflt]:" ; read target ; } +[ "$target" = "" ] && target=$DEPLOY_DIR__dflt +[ -d $target ] && _exit "The directory '$target' already exists !" +echo "Target directory: $target" case $type in 1) - $DEPLOY_SCR b $DIR/ADML-client - $DEPLOY_SCR b $DIR/ADML-server + $DEPLOY_SCR b $target/ADML-client + $DEPLOY_SCR b $target/ADML-server echo "Configuring ..." - cd $DIR/ADML-client + cd $target/ADML-client echo c | ./configure.sh >/dev/null cd - >/dev/null - cd $DIR/ADML-server + cd $target/ADML-server echo s | ./configure.sh >/dev/null cd - >/dev/null ;; 2) - $DEPLOY_SCR f $DIR/ADML-ft-client - $DEPLOY_SCR b $DIR/ADML-server + $DEPLOY_SCR f $target/ADML-ft-client + $DEPLOY_SCR b $target/ADML-server echo "Configuring ..." - cd $DIR/ADML-server + cd $target/ADML-server echo s | ./configure.sh >/dev/null cd - >/dev/null ;; 3) - $DEPLOY_SCR s $DIR/ADML-st-client - $DEPLOY_SCR b $DIR/ADML-serverGx - $DEPLOY_SCR b $DIR/ADML-serverRx + $DEPLOY_SCR s $target/ADML-st-client + $DEPLOY_SCR b $target/ADML-serverGx + $DEPLOY_SCR b $target/ADML-serverRx echo "Configuring ..." - cd $DIR/ADML-st-client + cd $target/ADML-st-client ln -s services_example services mv run.sh .run-one.sh mv run_all.sh run.sh @@ -88,12 +107,12 @@ case $type in mv operation_all.sh operation.sh rm dictionary.xml cd - >/dev/null - cd $DIR/ADML-serverGx + cd $target/ADML-serverGx echo s | ./configure.sh >/dev/null sed -i 's/3868/3869/' services.xml ln -sf stacks/other_examples/16777238.xml dictionary.xml cd - >/dev/null - cd $DIR/ADML-serverRx + cd $target/ADML-serverRx echo s | ./configure.sh >/dev/null ln -sf stacks/other_examples/16777236.xml dictionary.xml cd - >/dev/null -- 2.20.1