opensim-tools – Blame information for rev 20

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