#!/bin/bash
# simxtd, automated simulator installer
# BSD-Licensed
# Copyright (c) <2009>, <Jeroen van Veen, OS-Networks>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the <organization> nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY <OS-Networks> ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL <OS-Networks> BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
oshome='/opt/opensim'
function buildos {
pushd $oshome/$simdir > /dev/null 2>&1
sh runprebuild.sh
nant
popd > /dev/null 2>&1
}
function buildmodrex {
pushd $oshome/$simdir/modrex/ModularRex > /dev/null 2>&1
sh runprebuild.sh
nant
cp -a RexParts/RexPython/Resources/* ../../bin/ScriptEngines/
cat modrex.ini ../../bin/OpenSim.ini.example > ../../bin/OpenSim.ini.modrex
popd > /dev/null 2>&1
}
function buildrexauth {
pushd $oshome/rexauth > /dev/null 2>&1
mono bin/Prebuild.exe /target nant
nant
popd > /dev/null 2>&1
}
function buildrexavatar {
pushd $oshome/rexavatar > /dev/null 2>&1
mono bin/Prebuild.exe /target nant
nant
popd > /dev/null 2>&1
}
#---------------------------------------------------------------------------#
function getvansim {
if [ -d "$oshome/$simdir" ]; then
echo -n "simulator-dir exists. Updating..."
pushd $oshome/$simdir > /dev/null 2>&1
svn update
buildos
popd > /dev/null 2>&1
else
echo -n "installing vanilla simulator..."
mkdir $oshome/$simdir/ > /dev/null 2>&1
svn co http://opensimulator.org/svn/opensim/trunk $oshome/$simdir
buildos
fi
}
function getrexsim {
if [ -d "$oshome/$simdir" ]; then
if [ ! -d "$oshome/$simdir/modrex" ]; then
echo "this is a vanilla simulator. action aborted..."
exit 0
fi
echo -n "simulator-dir exists. Updating..."
pushd $oshome/$simdir > /dev/null 2>&1
svn update
buildos
pushd $oshome/$simdir/modrex/ModularRex > /dev/null 2>&1
svn update
buildmodrex
popd > /dev/null 2>&1
popd > /dev/null 2>&1
else
echo "installing modrex simulator..."
mkdir $oshome/$simdir/ $oshome/$simdir/modrex > /dev/null 2>&1
svn co http://opensimulator.org/svn/opensim/trunk $oshome/$simdir
buildos
svn co http://forge.opensimulator.org/svn/modrex/trunk $oshome/$simdir/modrex
buildmodrex
fi
}
function getrexavauth {
if [ -d "$oshome/rexauth" ]; then
echo "realxtend authentication service-dir exists. Updating..."
pushd $oshome/rexauth > /dev/null 2>&1
svn update
buildrexauth
else
echo "installing realxtend authentication service..."
svn co https://realxtendserver.svn.sourceforge.net/svnroot/realxtendserver/authentication/trunk $oshome/rexauth
buildrexauth
fi
if [ -d "$oshome/rexavatar" ]; then
echo "realxtend avatarstorage service-dir exists. Updating..."
pushd $oshome/rexavatar > /dev/null 2>&1
svn update
buildrexavatar
else
echo "installing realxtend avatarstorage service..."
svn co https://realxtendserver.svn.sourceforge.net/svnroot/realxtendserver/avatarstorage/trunk $oshome/rexavatar
buildrexavatar
fi
}
function gethelp {
echo "$0 -vansim mydir - install or update a vanilla simulator in $oshome/mydir"
echo "$0 -rexsim mydir - install or update a modrex simulator in $oshome/mydir"
echo "$0 -rexavauth - install or update rexauth and rexavatar in $oshome/(rexauth/rexavatar)"
echo ""
echo "Hint: Use dirs that define mode(rex/van),type(sa/grid) and listener(9000/9100/9200); f.i. rex_sa9000"
echo ""
}
if [ "$#" -eq "2" ]; then
case "$1" in
"-vansim")
simdir="$2"
getvansim
;;
"-rexsim")
simdir="$2"
getrexsim
;;
*)
echo "Type $0 -help for help"
;;
esac
elif [ "$#" -eq "1" ]; then
case "$1" in
"-rexavauth")
getrexavauth
;;
"-help")
gethelp
;;
*)
echo "Type $0 -help for help"
;;
esac
else
echo "Type $0 -help for help"
fi
exit 0