-#!/bin/ksh
+#!/bin/bash
# Functions & variables
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=/opt/bin/anna/example_diameter_launcher
+EXEC=./debug/example_diameter_launcher
DPATH_dflt=$HOME/ADL
+RESOURCES_DIR=resources
_exit () {
echo
createRunScript () {
- echo "#!/bin/ksh" > run.sh
+ echo "#!/bin/bash" > run.sh
echo "EXE=\`cat .exe 2>/dev/null\`" >> run.sh
- echo "STARTED=\`ps -fea | grep \"\$EXE\" | grep -v grep\`" >> run.sh
- echo "[ \"\$EXE\" != \"\" -a \"\$STARTED\" != \"\" ] && { echo \"Already started!\"; echo \"\$STARTED\" ; exit ; }" >> run.sh
- echo "pre-start.sh" >> run.sh
+ echo "STARTED=\`pgrep \$EXE2>/dev/null\`" >> run.sh
+ echo "[ \$? -eq 0 ] && { echo \"Already started!\"; echo \"\$STARTED\" ; exit 1 ; }" >> run.sh
+ echo "./pre-start.sh" >> run.sh
echo "> launcher.traces" >> run.sh
- echo "EXE=\"ADL-launcher\"" >> run.sh
+ echo "EXE=\"./ADL-launcher\"" >> run.sh
echo "echo \$EXE > .exe" >> run.sh
echo >> run.sh
echo -n "\$EXE " >> run.sh
do
echo -n "$i " >> run.sh
done
+ echo -n "-cntDir counters " >> run.sh
echo "&" >> run.sh
chmod a+x run.sh
rm args.txt
createDictionaryPaths () {
-
-for i in stacks/*commands*xml
+ for i in stacks/*commands*xml
do
stacks/dependence.sh $i >/dev/null
stack=`basename $i`
# Default:
ln -s .dictionary__commands_qosControl.xml .dictionary
+
+ # Remove deps:
+ rm -f stacks/*.dep
}
#############
# EXECUTION #
#############
+cd `dirname $0`
echo
echo "---------------------------------------"
echo "Anna Diameter Launcher (ADL) deployment"
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..."
+[ "$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 installed in the system. Execute 'sudo scons install' for 'anna' suite."
-[[ ! -d $SETUPS_DIR ]] && _exit "Diameter stacks not found ($SETUPS_DIR). Perhaps you executed this script out of its parent path."
+[ ! -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."
+
+echo
+echo "Deploy (f)ull version or (l)ite version [l]:"
+read deploy_type
+[ "$deploy_type" = "" ] && deploy_type=l
+[ "$deploy_type" = "l" ] && RESOURCES_DIR=resources_lite
echo "Copying ..."
mkdir -p $DPATH
mkdir -p $DPATH/stacks
+mkdir -p $DPATH/DTDs
+mkdir -p $DPATH/counters
cp $EXEC $DPATH/ADL-launcher
-cp resources/* $DPATH
+cp -r $RESOURCES_DIR/* $DPATH
cp $SETUPS_DIR/*xml $DPATH/stacks
cp $SETUPS_DIR/*sh $DPATH/stacks
-cp $MSGDTD $DPATH
-cp $DCTDTD $DPATH
+cp $SETUPS_DIR/readme.txt $DPATH/stacks
+cp $MSGDTD $DPATH/DTDs
+cp $DCTDTD $DPATH/DTDs
echo "Preparing ..."
cd $DPATH
-createRunScript
+[ "$deploy_type" != "l" ] && createRunScript
createDictionaryPaths
cd - >/dev/null
# Help:
echo
-echo "Stacks available at '.dictionary__<stack description>', create a symbolic link from '.dictionary'."
-echo "That link points now to an QoS application dictionary. Template for xml messages (message.dtd) and"
-echo " dictionaries (dictionary.dtd) are informative, not actually required by process. Start with 'run.sh'."
+echo "Go to '$DPATH' and see README file"
+echo
+echo "Done!"
echo
echo