summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-26 20:22:03 +0000
committerPaweł Redman <pawel.redman@gmail.com>2017-12-26 20:22:03 +0000
commit1258693c35886fd819c7b908373b16bf624bb622 (patch)
tree29349df28fbf1a5cef5dce052aad85044447275e
parenta577b0674a025391023fc257efacbaab33fc2df2 (diff)
Source config from another file.
-rwxr-xr-xrun-instance.sh44
1 files 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 #
###################