#!/bin/bash TESTDIR=`mktemp -d` cp -Rapv legacyworlds-server-DIST/target/legacyworlds/legacyworlds-server-* $TESTDIR cd $TESTDIR/legacyworlds-server-*/sql cat > db-config.txt < data-source.xml < EOF java legacyworlds-server-main-*.jar --run-tool ImportText data/i18n-text.xml || exit 1 java legacyworlds-server-main-*.jar --run-tool ImportResources data/resources.xml || exit 1 java legacyworlds-server-main-*.jar --run-tool ImportTechs data/techs.xml || exit 1 java legacyworlds-server-main-*.jar --run-tool ImportBuildables data/buildables.xml || exit 1 java legacyworlds-server-main-*.jar & sleep 10 if ! ps ux | grep -q 'java -jar legacyworlds-server-main'; then exit 1; fi java legacyworlds-server-main-*.jar --run-tool Stop || { killall java exit 1; } java -jar legacyworlds-server-main-1.0.0-0.jar --run-tool CreateUser 'test@example.org 12blah34bleh en' || exit 1 java -jar legacyworlds-server-main-1.0.0-0.jar --run-tool CreateSuperuser 'test@example.org Turlututu' || exit 1