export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_${NSPORT}.cfg
export NSPORT
local initref="NameService=corbaname::"`hostname`":$NSPORT"
- echo "ORBInitRef $initref" > $OMNIORB_CONFIG
- LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg
+ #echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+ echo "InitRef = $initref" > $OMNIORB_CONFIG
+ export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg
rm ${LAST_RUNNING_CONFIG}
ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG}
break
fi
rm ${OMNIORB_CONFIG}
+rm ${LAST_RUNNING_CONFIG}
mycom=${PWD}/${comName}
fi
APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
-#echo $APPLI
+echo $APPLI
export APPLI
# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
if [ $# -ne 0 ] ; then
${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*"
else
+
${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
fi
--- /dev/null
+#!/bin/bash
+
+# --- retrieve APPLI path, relative to $HOME
+# on sarge, "which" gives not allways the absolute path...
+
+comName=`which $0`
+aa=${comName:0:1}
+if test x$aa == x\/; then
+ mycom=${comName}
+elif test x$aa == x\.; then
+ mycom=${PWD}/${comName:2}
+else
+ mycom=${PWD}/${comName}
+fi
+APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
+#echo $APPLI
+export APPLI
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- define port for CORBA naming service
+
+searchFreePort() {
+ echo -n "Searching for a free port for naming service: "
+ export NSPORT=2810
+ local limit=$NSPORT
+ let limit=limit+100
+ while [ 1 ]
+ do
+ aRes=`netstat -ltn | grep -E :${NSPORT}`
+ if [ -z "$aRes" ]; then
+ echo ${NSPORT} - Ok
+ local myhost=`hostname`
+ export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_${NSPORT}.cfg
+ export NSPORT
+ local initref="NameService=corbaname::"`hostname`":$NSPORT"
+ #echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+ echo "InitRef = $initref" > $OMNIORB_CONFIG
+ export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_test.cfg
+ rm ${LAST_RUNNING_CONFIG}
+ ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG}
+ break
+ fi
+ echo -n "${NSPORT} "
+ if [[ $NSPORT -eq $limit ]] ; then
+ echo
+ echo "Can't find a free port to launch omniNames"
+ echo "Try to kill the running servers and then launch SALOME again."
+ exit
+ fi
+ let NSPORT=NSPORT+1
+ done
+}
+
+# --- invoque shell with or without args
+
+searchFreePort
+
+if [ $# -ne 0 ] ; then
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*"
+else
+
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
+fi
+
+rm ${OMNIORB_CONFIG}
+rm ${LAST_RUNNING_CONFIG}