Files
opensim-docker/image-opensim/config/setup.sh
T
Robert Adams 8f26c479a1 Add setup so, if configuration is mounted exteranlly to the container,
the configuration files are modified before the container is run.
    This solves a bunch of the permission problems.
    Closes #12
2022-02-06 18:44:25 +00:00

41 lines
1.5 KiB
Bash
Executable File

#! /bin/bash
# Script run when the container starts and before OpenSimulator is started
#
# The operations done here are:
# -- if first time called, setup DB and initialize variables in configuration files
# -- move sub-config specific Includes.ini into the config directory
# -- update all the configuration files with environment variables
export OPENSIMBIN=${OPENSIMBIN:-/home/opensim/opensim/bin}
export CONFIGDIR=${CONFIGDIR:-$OPENSIMBIN/config}
echo "opensim-docker: setup.sh: CONFIGDIR=\"${CONFIGDIR}\""
FIRSTTIMEFLAG=${CONFIGDIR}/.configFirstTime
cd "$CONFIGDIR"
# This sets CONFIG_NAME which is the configuration subdirectory (like standalone)
source ./scripts/setEnvironment.sh
# If this is the first time run, do database setup and some one-time configuration updates
if [[ ! -e "$FIRSTTIMEFLAG" ]] ; then
echo "opensim-docker: setup.sh: first time"
cd "$CONFIGDIR"
# Do any database account and db creation
./scripts/initializeDb.sh
touch "$FIRSTTIMEFLAG"
fi
# Move the configuration include file into place
# This makes opensim/bin/config directory contain this INI file for this image/config
# Since all the regular configuration has been nulled out, this will be the only config
# after bin/OpenSimDefaults.ini and bin/OpenSim.ini
cd "$CONFIGDIR"
./scripts/linkInConfigs.sh
# Do any update to configuration files that happens each start
# This updates bin/OpenSim.ini and Regions/*.ini with needed values
cd "$CONFIGDIR"
./scripts/updateConfigFiles.sh