opensim-tools – Diff between revs 21 and 43
?pathlinks?
Rev 21 | Rev 43 | |||
---|---|---|---|---|
1 | #! /bin/bash |
1 | #! /bin/bash |
|
2 | ### BEGIN INIT INFO |
2 | ### BEGIN INIT INFO |
|
3 | # Provides: skeleton |
3 | # Provides: skeleton |
|
4 | # Required-Start: $remote_fs $syslog |
4 | # Required-Start: $remote_fs $syslog |
|
5 | # Required-Stop: $remote_fs $syslog |
5 | # Required-Stop: $remote_fs $syslog |
|
6 | # Default-Start: 2 3 4 5 |
6 | # Default-Start: 2 3 4 5 |
|
7 | # Default-Stop: 0 1 6 |
7 | # Default-Stop: 0 1 6 |
|
8 | # Short-Description: Example initscript |
8 | # Short-Description: Example initscript |
|
9 | # Description: This file should be used to construct scripts to be |
9 | # Description: This file should be used to construct scripts to be |
|
10 | # placed in /etc/init.d. |
10 | # placed in /etc/init.d. |
|
11 | ### END INIT INFO |
11 | ### END INIT INFO |
|
12 | |
12 | |
|
13 | ########################################################################### |
13 | ########################################################################### |
|
14 | ## Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 ## |
14 | ## Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 ## |
|
15 | ## Please see: http://www.gnu.org/licenses/gpl.html for legal details, ## |
15 | ## Please see: http://www.gnu.org/licenses/gpl.html for legal details, ## |
|
16 | ## rights of fair usage, the disclaimer and warranty conditions. ## |
16 | ## rights of fair usage, the disclaimer and warranty conditions. ## |
|
17 | ########################################################################### |
17 | ########################################################################### |
|
18 | |
18 | |
|
19 | # PATH should only include /usr/* if it runs after the mountnfs.sh script |
19 | # PATH should only include /usr/* if it runs after the mountnfs.sh script |
|
20 | PATH=/sbin:/usr/sbin:/bin:/usr/bin |
20 | PATH=/sbin:/usr/sbin:/bin:/usr/bin |
|
21 | DESC="OpenSim Bootstrap for Spectacled Owl" |
21 | DESC="OpenSim Bootstrap for Spectacled Owl" |
|
22 | |
22 | |
|
23 | # Load the VERBOSE setting and other rcS variables |
23 | # Load the VERBOSE setting and other rcS variables |
|
24 | . /lib/init/vars.sh |
24 | . /lib/init/vars.sh |
|
25 | |
25 | |
|
26 | # Define LSB log_* functions. |
26 | # Define LSB log_* functions. |
|
27 | # Depend on lsb-base (>= 3.2-14) to ensure that this file is present |
27 | # Depend on lsb-base (>= 3.2-14) to ensure that this file is present |
|
28 | # and status_of_proc is working. |
28 | # and status_of_proc is working. |
|
29 | . /lib/lsb/init-functions |
29 | . /lib/lsb/init-functions |
|
30 | |
30 | |
|
31 | do_start() |
31 | do_start() |
|
32 | { |
32 | { |
|
33 | if [ `hostname` == "SpectacledOwl" ]; then |
33 | if [ `hostname` == "SpectacledOwl" ]; then |
|
34 | EXTERNAL_ADDRESS=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1 ; exit }'` |
34 | EXTERNAL_ADDRESS=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1 ; exit }'` |
|
35 | GRID_NAME="SpectacledOwl" |
35 | GRID_NAME="SpectacledOwl" |
|
36 | else |
36 | else |
|
37 | EXTERNAL_ADDRESS=`hostname` |
37 | EXTERNAL_ADDRESS=`hostname -f` |
|
38 | GRID_NAME=`echo $EXTERNAL_ADDRESS | awk 'BEGIN { FS = "." } ; { print $1 }'` |
38 | GRID_NAME=`echo $EXTERNAL_ADDRESS | awk 'BEGIN { FS = "." } ; { print $1 }'` |
|
39 | fi |
39 | fi |
|
40 | |
40 | |
|
41 | DAEMON_DIR='/home/opensim/os' |
41 | DAEMON_DIR='/home/opensim/os' |
|
42 | REGION_DIR='/home/opensim/os/Regions' |
42 | REGION_DIR='/home/opensim/os/Regions' |
|
43 | CONFIG_DIR='/home/opensim/os/config-include' |
43 | CONFIG_DIR='/home/opensim/os/config-include' |
|
44 | |
44 | |
|
45 | echo "[OpenSim BootStrap] BootStrapping... Please wait..." |
45 | echo "[OpenSim BootStrap] BootStrapping... Please wait..." |
|
46 | |
46 | |
|
47 | if [ -z $EXTERNAL_ADDRESS ]; then |
47 | if [ -z $EXTERNAL_ADDRESS ]; then |
|
48 | echo "[OpenSim BootStrap ERROR] : Could not find an external address." |
48 | echo "[OpenSim BootStrap ERROR] : Could not find an external address." |
|
49 | exit |
49 | exit |
|
50 | fi |
50 | fi |
|
51 | |
51 | |
|
52 | if [ ! -d $DAEMON_DIR ] || [ ! -d $REGION_DIR ] || [ ! -d $CONFIG_DIR ]; then |
52 | if [ ! -d $DAEMON_DIR ] || [ ! -d $REGION_DIR ] || [ ! -d $CONFIG_DIR ]; then |
|
53 | echo "[OpenSIm BootStrap ERROR] : Daemon directory not found." |
53 | echo "[OpenSIm BootStrap ERROR] : Daemon directory not found." |
|
54 | exit |
54 | exit |
|
55 | fi |
55 | fi |
|
56 | |
56 | |
|
57 | if [ ! -f $CONFIG_DIR/StandaloneCommon.ini ]; then |
57 | if [ ! -f $CONFIG_DIR/StandaloneCommon.ini ]; then |
|
58 | echo "[OpenSim BootStrap ERROR] : Configuration files could not be found." |
58 | echo "[OpenSim BootStrap ERROR] : Configuration files could not be found." |
|
59 | exit |
59 | exit |
|
60 | fi |
60 | fi |
|
61 | |
61 | |
|
62 | # BootStrap OpenSim |
62 | # BootStrap OpenSim |
|
63 | sed -i "s/ExternalHostNameForLSL *=.*/ExternalHostNameForLSL = \"$EXTERNAL_ADDRESS\"/g" \ |
63 | sed -i "s/ExternalHostNameForLSL *=.*/ExternalHostNameForLSL = \"$EXTERNAL_ADDRESS\"/g" \ |
|
64 | $DAEMON_DIR/OpenSim.ini; |
64 | $DAEMON_DIR/OpenSim.ini; |
|
65 | |
65 | |
|
66 | # Bootstrap region addresses. |
66 | # Bootstrap region addresses. |
|
67 | sed -i "s/ExternalHostName *=.*/ExternalHostName = $EXTERNAL_ADDRESS/g" \ |
67 | sed -i "s/ExternalHostName *=.*/ExternalHostName = $EXTERNAL_ADDRESS/g" \ |
|
68 | $REGION_DIR/Regions.ini; |
68 | $REGION_DIR/Regions.ini; |
|
69 | |
69 | |
|
70 | # Bootstrap configuration addresses. |
70 | # Bootstrap configuration addresses. |
|
71 | sed -i "s/HomeURI *=.*/HomeURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
71 | sed -i "s/HomeURI *=.*/HomeURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
72 | $CONFIG_DIR/StandaloneCommon.ini; |
72 | $CONFIG_DIR/StandaloneCommon.ini; |
|
73 | sed -i "s/Gatekeeper *=.*/Gatekeeper = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
73 | sed -i "s/Gatekeeper *=.*/Gatekeeper = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
74 | $CONFIG_DIR/StandaloneCommon.ini; |
74 | $CONFIG_DIR/StandaloneCommon.ini; |
|
75 | sed -i "s/GatekeeperURI *=.*/GatekeeperURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
75 | sed -i "s/GatekeeperURI *=.*/GatekeeperURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
76 | $CONFIG_DIR/StandaloneCommon.ini; |
76 | $CONFIG_DIR/StandaloneCommon.ini; |
|
77 | sed -i "s/SRV_HomeURI *=.*/SRV_HomeURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
77 | sed -i "s/SRV_HomeURI *=.*/SRV_HomeURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
78 | $CONFIG_DIR/StandaloneCommon.ini; |
78 | $CONFIG_DIR/StandaloneCommon.ini; |
|
79 | sed -i "s/SRV_InventoryServerURI *=.*/SRV_InventoryServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
79 | sed -i "s/SRV_InventoryServerURI *=.*/SRV_InventoryServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
80 | $CONFIG_DIR/StandaloneCommon.ini; |
80 | $CONFIG_DIR/StandaloneCommon.ini; |
|
81 | sed -i "s/SRV_AssetServerURI *=.*/SRV_AssetServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
81 | sed -i "s/SRV_AssetServerURI *=.*/SRV_AssetServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
82 | $CONFIG_DIR/StandaloneCommon.ini; |
82 | $CONFIG_DIR/StandaloneCommon.ini; |
|
83 | sed -i "s/SRV_ProfileServerURI *=.*/SRV_ProfileServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
83 | sed -i "s/SRV_ProfileServerURI *=.*/SRV_ProfileServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
84 | $CONFIG_DIR/StandaloneCommon.ini; |
84 | $CONFIG_DIR/StandaloneCommon.ini; |
|
85 | sed -i "s/SRV_GroupsServerURI *=.*/SRV_GroupsServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
85 | sed -i "s/SRV_GroupsServerURI *=.*/SRV_GroupsServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
86 | $CONFIG_DIR/StandaloneCommon.ini |
86 | $CONFIG_DIR/StandaloneCommon.ini |
|
87 | sed -i "s/FriendsServerURI *=.*/FriendsServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
87 | sed -i "s/FriendsServerURI *=.*/FriendsServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
88 | $CONFIG_DIR/StandaloneCommon.ini; |
88 | $CONFIG_DIR/StandaloneCommon.ini; |
|
89 | sed -i "s/IMServerURI *=.*/IMServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
89 | sed -i "s/IMServerURI *=.*/IMServerURI = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
90 | $CONFIG_DIR/StandaloneCommon.ini; |
90 | $CONFIG_DIR/StandaloneCommon.ini; |
|
91 | sed -i "s/MapTileURL *=.*/MapTileURL = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
91 | sed -i "s/MapTileURL *=.*/MapTileURL = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
92 | $CONFIG_DIR/StandaloneCommon.ini; |
92 | $CONFIG_DIR/StandaloneCommon.ini; |
|
93 | sed -i "s/ExternalName *=.*/ExternalName = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
93 | sed -i "s/ExternalName *=.*/ExternalName = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
94 | $CONFIG_DIR/StandaloneCommon.ini; |
94 | $CONFIG_DIR/StandaloneCommon.ini; |
|
95 | sed -i "s/login *=.*/login = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
95 | sed -i "s/login *=.*/login = \"http:\/\/$EXTERNAL_ADDRESS:9000\"/g" \ |
|
96 | $CONFIG_DIR/StandaloneCommon.ini; |
96 | $CONFIG_DIR/StandaloneCommon.ini; |
|
97 | sed -i "s/gridname *=.*/gridname = \"$GRID_NAME\"/g" \ |
97 | sed -i "s/gridname *=.*/gridname = \"$GRID_NAME\"/g" \ |
|
98 | $CONFIG_DIR/StandaloneCommon.ini; |
98 | $CONFIG_DIR/StandaloneCommon.ini; |
|
99 | sed -i "s/gridnick *=.*/gridnick = \"$GRID_NAME\"/g" \ |
99 | sed -i "s/gridnick *=.*/gridnick = \"$GRID_NAME\"/g" \ |
|
100 | $CONFIG_DIR/StandaloneCommon.ini; |
100 | $CONFIG_DIR/StandaloneCommon.ini; |
|
101 | sed -i "s/welcome *=.*/welcome = \"http:\/\/$EXTERNAL_ADDRESS\/welcome\.php\"/g" \ |
101 | sed -i "s/welcome *=.*/welcome = \"http:\/\/$EXTERNAL_ADDRESS\/welcome\.php\"/g" \ |
|
102 | $CONFIG_DIR/StandaloneCommon.ini; |
102 | $CONFIG_DIR/StandaloneCommon.ini; |
|
103 | sed -i "s/register *=.*/register = \"http:\/\/$EXTERNAL_ADDRESS\/register\.php\"/g" \ |
103 | sed -i "s/register *=.*/register = \"http:\/\/$EXTERNAL_ADDRESS\/register\.php\"/g" \ |
|
104 | $CONFIG_DIR/StandaloneCommon.ini; |
104 | $CONFIG_DIR/StandaloneCommon.ini; |
|
105 | sed -i "s/about *=.*/about = \"http:\/\/$EXTERNAL_ADDRESS\/about\.php\"/g" \ |
105 | sed -i "s/about *=.*/about = \"http:\/\/$EXTERNAL_ADDRESS\/about\.php\"/g" \ |
|
106 | $CONFIG_DIR/StandaloneCommon.ini; |
106 | $CONFIG_DIR/StandaloneCommon.ini; |
|
107 | |
107 | |
|
108 | echo "[OpenSim BootStrap] Bootstrap successful." |
108 | echo "[OpenSim BootStrap] Bootstrap successful." |
|
109 | } |
109 | } |
|
110 | |
110 | |
|
111 | case "$1" in |
111 | case "$1" in |
|
112 | start) |
112 | start) |
|
113 | [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" |
113 | [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" |
|
114 | do_start |
114 | do_start |
|
115 | case "$?" in |
115 | case "$?" in |
|
116 | 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; |
116 | 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; |
|
117 | 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; |
117 | 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; |
|
118 | esac |
118 | esac |
|
119 | ;; |
119 | ;; |
|
120 | stop) |
120 | stop) |
|
121 | # Nothing to stop here. |
121 | # Nothing to stop here. |
|
122 | ;; |
122 | ;; |
|
123 | *) |
123 | *) |
|
124 | echo "Usage: $SCRIPTNAME {start|stop}" >&2 |
124 | echo "Usage: $SCRIPTNAME {start|stop}" >&2 |
|
125 | exit 3 |
125 | exit 3 |
|
126 | ;; |
126 | ;; |
|
127 | esac |
127 | esac |
|
128 | |
128 | |
|
129 | : |
129 | : |
|
130 | |
130 | |
|
131 | |
131 | |