#!/bin/sh # Function used to run initialization commands. run_init_command() { local stage="$1" shift if ! [ -f state/init-$stage ]; then echo "Running initialization stage $stage" echo " --> $*" if /app/entrypoint.sh tool $* then touch state/init-$stage else exit 1 fi fi } cd /app if ! [ -z "$LW_CONFIGURE" ]; then if [ -z "$LW_DB_PASSWORD_FILE" ]; then password="$LW_DB_PASSWORD" else password="`cat $LW_DB_PASSWORD_FILE`" fi cat >data-source.xml < EOF fi cmd="$1" shift if [ "$cmd" == server ]; then run_init_command import-text ImportText data/i18n-text.xml run_init_command import-techs ImportTechs data/techs.xml run_init_command import-buildables ImportBuildables data/buildables.xml exec /usr/bin/java \ -Dlog4j.configuration=log4j.properties \ -jar server.jar elif [ "$cmd" == shell ]; then exec /bin/sh elif [ "$cmd" == tool ]; then tool="$1" shift exec /usr/bin/java \ -Dlog4j.configuration=log4j.properties \ -jar server.jar \ --run-tool "$tool" "$*" else echo "Invalid command '$cmd'" >&2 exit 1 fi