From ca7a2ed839f8fec5a7d7abbf50fc2c031f192fb5 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 22 May 2019 19:14:35 +1000 Subject: Major tweaking of the scripts to suit the new setup. --- scripts/install/create_sim.sh | 55 +++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'scripts/install/create_sim.sh') diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh index 0681067..08cedba 100755 --- a/scripts/install/create_sim.sh +++ b/scripts/install/create_sim.sh @@ -1,6 +1,6 @@ #!/bin/bash -source common.sh +source ../common.sh getPrgDir NAME=$1 @@ -9,8 +9,7 @@ URL=$3 IP=$4 SIZE=$5 -OSPATH="/opt/opensim" -cd $OSPATH/config +cd ${OS_PATH}/config k=0 for i in $(seq -w 1 99) @@ -22,38 +21,37 @@ do fi done -if [ "x$NAME" = "x" ] +if [ "x${NAME}" = "x" ] then NAME="No name sim $RANDOM" # Should be unique per grid. - echo "WARNING setting the sim name to [$NAME], this may not be what you want." + echo "WARNING setting the sim name to [${NAME}], this may not be what you want." fi # Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. -sim=$(sanitize $NAME) +sim=$(sanitize ${NAME}) -if [ "x$LOCATION" = "x" ] +if [ "x${LOCATION}" = "x" ] then LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! - echo "WARNING setting the Location to $LOCATION, this may not be what you want." + echo "WARNING setting the Location to ${LOCATION}, this may not be what you want." fi -if [ "x$IP" = "x" ] +if [ "x${IP}" = "x" ] then - # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. IP="0.0.0.0" - echo "WARNING setting the InternalAddress to $IP, this may not be what you want." + echo "WARNING setting the InternalAddress to ${IP}, this may not be what you want." # echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." # According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. fi -if [ "x$URL" = "x" ] +if [ "x${URL}" = "x" ] then # Here we make use of an external IP finding service. Careful, it may move. # URL=$(wget -q http://automation.whatismyip.com/n09230945.asp -O -) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too. URL="SYSTEMIP" - echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." + echo "WARNING setting the ExternalHostName to ${URL}, this may not be what you want." fi -if [ "x$SIZE" = "x" ] +if [ "x${SIZE}" = "x" ] then SIZE="256" fi @@ -68,29 +66,30 @@ fi PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. UUID=$(uuidgen) -echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME." +echo "Creating sim${NUM} on port ${PORT} @ ${LOCATION} - ${NAME}." -cp -r sim_skeleton sim$NUM +cp -r sim_skeleton sim${NUM} -cd sim$NUM +cd sim${NUM} mv My_sim.xml ${sim}.xml -sed -i "s@SIM_NAME@$NAME@g" ${sim}.xml -sed -i "s@SIM_UUID@$UUID@g" ${sim}.xml -sed -i "s@SIM_POS@$LOCATION@g" ${sim}.xml -sed -i "s@SIM_IP@$IP@g" ${sim}.xml -sed -i "s@SIM_INT_PORT@$(( $PORT + 1 ))@g" ${sim}.xml -sed -i "s@SIM_URL@$URL@g" ${sim}.xml -sed -i "s@SIM_SIZE@$SIZE@g" ${sim}.xml +sed -i "s@SIM_NAME@${NAME}@g" ${sim}.xml +sed -i "s@SIM_UUID@${UUID}@g" ${sim}.xml +sed -i "s@SIM_POS@${LOCATION}@g" ${sim}.xml +sed -i "s@SIM_IP@${IP}@g" ${sim}.xml +sed -i "s@SIM_INT_PORT@$(( ${PORT} + 1 ))@g" ${sim}.xml +sed -i "s@SIM_URL@${URL}@g" ${sim}.xml +sed -i "s@SIM_SIZE@${SIZE}@g" ${sim}.xml ln -s ../../current/scripts/common.sh common.sh ln -s ../../current/scripts/start-sim start-sim cp -P start-sim backup-sim cp -P start-sim stop-sim -sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini -sed -i "s@SIM_PORT@$PORT@g" ThisSim.ini +sed -i "s@SIM_NUMBER@${NUM}@g" ThisSim.ini +sed -i "s@SIM_PORT@${PORT}@g" ThisSim.ini -sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf +sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf +sed -i "s@SIM_NUMBER@${NUM}@g" opensim-monit.conf -sudo chown -R opensim:opensim .. +sudo chown -R ${OS_USER}:${OS_USER} .. sudo chmod -R g+w .. -- cgit v1.1