summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-26 20:07:45 +0000
committerPaweł Redman <pawel.redman@gmail.com>2017-12-26 20:07:45 +0000
commita577b0674a025391023fc257efacbaab33fc2df2 (patch)
tree04b84299dd9f39758b22fe179395528ba445f416
parent4fbda5a9af95345504636d178e26b248791a2262 (diff)
Overwrite autogen instead of exec'ing configs.
-rwxr-xr-xrun-instance.sh48
1 files changed, 15 insertions, 33 deletions
diff --git a/run-instance.sh b/run-instance.sh
index cdb8342..2cdfad9 100755
--- a/run-instance.sh
+++ b/run-instance.sh
@@ -14,9 +14,8 @@ COMMON="$PREFIX/common"
HOME_PREFIX="$PREFIX/home@"
FS_GAME="slacker"
-# Config directory: as seen by tremded's vfs and the absolute path, respectively.
-CONFIG_LOCAL="config"
-CONFIG_GLOBAL="$PREFIX/$CONFIG_LOCAL"
+# Config directory.
+CONFIG_PREFIX="$PREFIX/config/"
# Executables.
GDB_WRAPPER="$PREFIX/bin/gdb-wrapper2.sh"
@@ -56,22 +55,6 @@ function check_dir {
[ -d "$1" ] || error "%s '%s' is not a directory\n" "$2" "$1"
}
-function ensure_link {
- if [ -L "$2" ]; then
- debug "ensure_link: '%s' already exists\n" "$2"
- if [ `readlink "$2"` == "$1" ]; then
- return
- fi
-
- debug "ensure_link: ...and points at '%s' instead of '%s'\n" `readlink "$2"` "$1"
- unlink "$2" || error "couldn't unlink '%s'\n" "$2"
- fi
-
- mkdir -p `dirname "$2"` || error
- ln -s "$1" "$2" || error "linking failed\n"
- debug "ensure_link: linked '%s' -> '%s'\n" "$2" "$1"
-}
-
###################
# The entry point #
###################
@@ -83,29 +66,28 @@ function ensure_link {
I="$1"
TREMDED="$TREMDED_PREFIX$I"
HOME="$HOME_PREFIX$I"
-CONFIG_LOCAL_COMMON="$CONFIG_LOCAL/common.cfg"
-CONFIG_LOCAL_INST="$CONFIG_LOCAL/$I.cfg"
-CONFIG_GLOBAL_COMMON="$CONFIG_GLOBAL/common.cfg"
-CONFIG_GLOBAL_INST="$CONFIG_GLOBAL/$I.cfg"
-
-# Do some integrity tests and fix missing links.
-check_file "$TREMDED" "the tremded"
-check_dir "$HOME" "the home directory"
-check_file "$CONFIG_GLOBAL_COMMON" "the common config"
-check_file "$CONFIG_GLOBAL_INST" "the instance-specific config"
-ensure_link "${CONFIG_GLOBAL}" "$HOME/$FS_GAME/$CONFIG_LOCAL"
+CONFIG_COMMON="$CONFIG_PREFIX/common.cfg"
+CONFIG_INST="$CONFIG_PREFIX/$I.cfg"
+
+# Do some integrity checks.
+check_file "$TREMDED" "the tremded"
+check_dir "$HOME" "the home directory"
+check_file "$CONFIG_COMMON" "the common config"
+check_file "$CONFIG_INST" "the instance-specific config"
+
+# Server configuration is done by overwiting the autogen.
+cat "$CONFIG_COMMON" "$CONFIG_INST" > "$HOME/$FS_GAME/autogen_server.cfg" \
+ || error "couldn't overwrite the autogen\n"
# cd to HOME (that's where cores will appear) and start the server.
cd "$HOME" || error "cannot chdir to %s\n" "$HOME"
-#"$GDB_WRAPPER" "$TREMDED" \
-"$TREMDED" \
+"$GDB_WRAPPER" "$TREMDED" \
+exec "$CONFIG_LOCAL_COMMON" \
+set fs_basepath "$COMMON" \
+set fs_homepath "$HOME" \
+set fs_game "$FS_GAME" \
+set com_pipefile "pipe" \
+set dedicated 2 \
- +exec "$CONFIG_LOCAL_INST" \
+map "atcs" \
+nocurses \
"$@" || error "couldn't start the server\n"