diff options
Diffstat (limited to 'scripts/install/create_sim.sh')
-rwxr-xr-x | scripts/install/create_sim.sh | 55 |
1 files changed, 27 insertions, 28 deletions
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 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | source common.sh | 3 | source ../common.sh |
4 | getPrgDir | 4 | getPrgDir |
5 | 5 | ||
6 | NAME=$1 | 6 | NAME=$1 |
@@ -9,8 +9,7 @@ URL=$3 | |||
9 | IP=$4 | 9 | IP=$4 |
10 | SIZE=$5 | 10 | SIZE=$5 |
11 | 11 | ||
12 | OSPATH="/opt/opensim" | 12 | cd ${OS_PATH}/config |
13 | cd $OSPATH/config | ||
14 | 13 | ||
15 | k=0 | 14 | k=0 |
16 | for i in $(seq -w 1 99) | 15 | for i in $(seq -w 1 99) |
@@ -22,38 +21,37 @@ do | |||
22 | fi | 21 | fi |
23 | done | 22 | done |
24 | 23 | ||
25 | if [ "x$NAME" = "x" ] | 24 | if [ "x${NAME}" = "x" ] |
26 | then | 25 | then |
27 | NAME="No name sim $RANDOM" # Should be unique per grid. | 26 | NAME="No name sim $RANDOM" # Should be unique per grid. |
28 | echo "WARNING setting the sim name to [$NAME], this may not be what you want." | 27 | echo "WARNING setting the sim name to [${NAME}], this may not be what you want." |
29 | fi | 28 | fi |
30 | # Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. | 29 | # Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. |
31 | sim=$(sanitize $NAME) | 30 | sim=$(sanitize ${NAME}) |
32 | 31 | ||
33 | if [ "x$LOCATION" = "x" ] | 32 | if [ "x${LOCATION}" = "x" ] |
34 | then | 33 | then |
35 | LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! | 34 | LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! |
36 | echo "WARNING setting the Location to $LOCATION, this may not be what you want." | 35 | echo "WARNING setting the Location to ${LOCATION}, this may not be what you want." |
37 | fi | 36 | fi |
38 | 37 | ||
39 | if [ "x$IP" = "x" ] | 38 | if [ "x${IP}" = "x" ] |
40 | then | 39 | then |
41 | # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. | ||
42 | IP="0.0.0.0" | 40 | IP="0.0.0.0" |
43 | echo "WARNING setting the InternalAddress to $IP, this may not be what you want." | 41 | echo "WARNING setting the InternalAddress to ${IP}, this may not be what you want." |
44 | # echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." | 42 | # echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." |
45 | # According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. | 43 | # According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. |
46 | fi | 44 | fi |
47 | 45 | ||
48 | if [ "x$URL" = "x" ] | 46 | if [ "x${URL}" = "x" ] |
49 | then | 47 | then |
50 | # Here we make use of an external IP finding service. Careful, it may move. | 48 | # Here we make use of an external IP finding service. Careful, it may move. |
51 | # 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. | 49 | # 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. |
52 | URL="SYSTEMIP" | 50 | URL="SYSTEMIP" |
53 | echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." | 51 | echo "WARNING setting the ExternalHostName to ${URL}, this may not be what you want." |
54 | fi | 52 | fi |
55 | 53 | ||
56 | if [ "x$SIZE" = "x" ] | 54 | if [ "x${SIZE}" = "x" ] |
57 | then | 55 | then |
58 | SIZE="256" | 56 | SIZE="256" |
59 | fi | 57 | fi |
@@ -68,29 +66,30 @@ fi | |||
68 | PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. | 66 | PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. |
69 | UUID=$(uuidgen) | 67 | UUID=$(uuidgen) |
70 | 68 | ||
71 | echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME." | 69 | echo "Creating sim${NUM} on port ${PORT} @ ${LOCATION} - ${NAME}." |
72 | 70 | ||
73 | cp -r sim_skeleton sim$NUM | 71 | cp -r sim_skeleton sim${NUM} |
74 | 72 | ||
75 | cd sim$NUM | 73 | cd sim${NUM} |
76 | mv My_sim.xml ${sim}.xml | 74 | mv My_sim.xml ${sim}.xml |
77 | sed -i "s@SIM_NAME@$NAME@g" ${sim}.xml | 75 | sed -i "s@SIM_NAME@${NAME}@g" ${sim}.xml |
78 | sed -i "s@SIM_UUID@$UUID@g" ${sim}.xml | 76 | sed -i "s@SIM_UUID@${UUID}@g" ${sim}.xml |
79 | sed -i "s@SIM_POS@$LOCATION@g" ${sim}.xml | 77 | sed -i "s@SIM_POS@${LOCATION}@g" ${sim}.xml |
80 | sed -i "s@SIM_IP@$IP@g" ${sim}.xml | 78 | sed -i "s@SIM_IP@${IP}@g" ${sim}.xml |
81 | sed -i "s@SIM_INT_PORT@$(( $PORT + 1 ))@g" ${sim}.xml | 79 | sed -i "s@SIM_INT_PORT@$(( ${PORT} + 1 ))@g" ${sim}.xml |
82 | sed -i "s@SIM_URL@$URL@g" ${sim}.xml | 80 | sed -i "s@SIM_URL@${URL}@g" ${sim}.xml |
83 | sed -i "s@SIM_SIZE@$SIZE@g" ${sim}.xml | 81 | sed -i "s@SIM_SIZE@${SIZE}@g" ${sim}.xml |
84 | 82 | ||
85 | ln -s ../../current/scripts/common.sh common.sh | 83 | ln -s ../../current/scripts/common.sh common.sh |
86 | ln -s ../../current/scripts/start-sim start-sim | 84 | ln -s ../../current/scripts/start-sim start-sim |
87 | cp -P start-sim backup-sim | 85 | cp -P start-sim backup-sim |
88 | cp -P start-sim stop-sim | 86 | cp -P start-sim stop-sim |
89 | 87 | ||
90 | sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini | 88 | sed -i "s@SIM_NUMBER@${NUM}@g" ThisSim.ini |
91 | sed -i "s@SIM_PORT@$PORT@g" ThisSim.ini | 89 | sed -i "s@SIM_PORT@${PORT}@g" ThisSim.ini |
92 | 90 | ||
93 | sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf | 91 | sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf |
92 | sed -i "s@SIM_NUMBER@${NUM}@g" opensim-monit.conf | ||
94 | 93 | ||
95 | sudo chown -R opensim:opensim .. | 94 | sudo chown -R ${OS_USER}:${OS_USER} .. |
96 | sudo chmod -R g+w .. | 95 | sudo chmod -R g+w .. |