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