From 1258693c35886fd819c7b908373b16bf624bb622 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Tue, 26 Dec 2017 20:22:03 +0000 Subject: Source config from another file. --- run-instance.sh | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/run-instance.sh b/run-instance.sh index 2cdfad9..74fc883 100755 --- a/run-instance.sh +++ b/run-instance.sh @@ -1,26 +1,5 @@ #!/bin/bash -################# -# Configuration # -################# - -DEBUG=1 - -# The root directory. -PREFIX="/home/tremded" - -# fs_basepath, fs_homepath and fs_game. -COMMON="$PREFIX/common" -HOME_PREFIX="$PREFIX/home@" -FS_GAME="slacker" - -# Config directory. -CONFIG_PREFIX="$PREFIX/config/" - -# Executables. -GDB_WRAPPER="$PREFIX/bin/gdb-wrapper2.sh" -TREMDED_PREFIX="$PREFIX/bin/tremded@" - #################### # Helper functions # #################### @@ -55,6 +34,29 @@ function check_dir { [ -d "$1" ] || error "%s '%s' is not a directory\n" "$2" "$1" } +################# +# Configuration # +################# + +# Load the script configuration and set some defaults. +source run-instance.local.sh || error "missing config\n" +[ -z "$PREFIX" ] && error "PREFIX is not set\n" + +# fs_basepath, fs_homepath and fs_game. +true ${COMMON:="$PREFIX/common"} +true ${HOME_PREFIX:="$PREFIX/home@"} +true ${FS_GAME:="slacker"} + +# Config directory. +true ${CONFIG_PREFIX:="$PREFIX/config/"} + +# Executables. +true ${GDB_WRAPPER:="$PREFIX/bin/gdb-wrapper2.sh"} +true ${TREMDED_PREFIX:="$PREFIX/bin/tremded@"} + +# Debugging +true ${DEBUG:=1} + ################### # The entry point # ################### -- cgit