#!/usr/local/bin/bash # Copyright (C) Wizardry and Steamworks. # # Licensed to Wizardry and Steamworks under # the GPLv3 GNU License which can be found at: # http://www.gnu.org/licenses/gpl.html # # The osstrap bootstraps the daemon with multiple # parameters taken from the operating system and # ensures that the daemon is configured on boot. # Pause... sleep 60 # Go! if [ `hostname` == "snowyowl" ]; then EXTERNAL_ADDRESS=`ifconfig | awk '/inet/{ print $2 ; exit }'` GRID_NAME="snowyowl" else EXTERNAL_ADDRESS=`hostname` GRID_NAME=`echo $EXTERNAL_ADDRESS | awk 'BEGIN { FS = "." } ; { print $1 }'` fi DAEMON_DIR='/home/opensim/opensim-daemon/' REGION_DIR='/home/opensim/opensim-daemon/Regions/' CONFIG_DIR='/home/opensim/opensim-daemon/config-include' echo "[OpenSim BootStrap] BootStrapping... Please wait..." if [ -z $EXTERNAL_ADDRESS ]; then echo "[OpenSim BootStrap ERROR] : Could not find an external address." exit fi if [ ! -d $DAEMON_DIR ] || [ ! -d $REGION_DIR ] || [ ! -d $CONFIG_DIR ]; then echo "[OpenSIm BootStrap ERROR] : Daemon directory not found." exit fi if [ ! -f $CONFIG_DIR/StandaloneCommon.ini ]; then echo "[OpenSim BootStrap ERROR] : Configuration files could not be found." exit fi # BootStrap Regions echo "[OpenSim BootStrap] Setting up regions..." function uuidgen { local UUID=$(printf "%s%s-%s-%s-%s-%s%s%s\n" `jot -r -w "%04x" 8 0 65536`) echo "$UUID"; } if [ ! -f $REGION_DIR/Regions.ini ]; then declare -a TEMPLATE_REGION_NAMES=('Arber' 'Baer' 'Cuvier' 'Dart'); declare -a TEMPLATE_COORDINATES=('5000,5000' '5000,5001' '5001,5000' '5001,5001'); declare -a TEMPLATE_PORTS=('9001' '9002' '9003' '9004'); declare -a TEMPLATE_REGION_UUIDS=('abeca4d9-9edf-4f5d-8cd6-6b29895436da' 'b2e67ec1-2a27-4d9e-9d02-68cafd2dbc9d' 'c06b7b49-7c23-4a21-a770-0a6bd0f13f77' 'd48cdc16-f718-45b7-88d7-69cb337080b9'); for (( rix=0 ; rix < ${#TEMPLATE_REGION_NAMES[@]} ; rix++ )); do NEW_UUID=$(uuidgen) mysql -u opensim --password=opensim4biose -D opensim_estates -e "UPDATE estate_map SET RegionID='$NEW_UUID' WHERE RegionID='${TEMPLATE_REGION_UUIDS[$rix]}'" cat >> $REGION_DIR/Regions.ini <