From 0fe8c31b72e069dfad5520f1c605846a9e65a1c0 Mon Sep 17 00:00:00 2001 From: Mitch Weaver Date: Wed, 29 Nov 2023 06:30:19 -0600 Subject: [PATCH] asdf --- modserver_update.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/modserver_update.sh b/modserver_update.sh index 7e7d527..b31f7a0 100644 --- a/modserver_update.sh +++ b/modserver_update.sh @@ -18,12 +18,24 @@ # =================================================== echo "Starting, attempting to load globals.sh" -# grab fresh copy of all helper scripts / libraries -if [ -d "$PWD/lib" ] ; then - cp -f "$PWD/lib"/* . +# if we are called externally by one of the servers, +# the command will be "~/dayz-servers/modserver_update.sh" +# we need to change from $PWD to accomodate for that +export WORKING_DIR=$PWD +if [ ! -d "$WORKING_DIR"/lib ] ; then + export WORKING_DIR="$HOME/dayz-servers" + if [ ! -d "$WORKING_DIR"/lib ] ; then + >&2 echo "Could not find lib. Exiting" + exit 1 + fi fi -GLOBALS_FILE="$PWD/globals.sh" +# grab fresh copy of all helper scripts / libraries +if [ -d "$WORKING_DIR/lib" ] ; then + cp -f "$WORKING_DIR/lib"/* . +fi + +GLOBALS_FILE="$WORKING_DIR/globals.sh" if [ -e "$GLOBALS_FILE" ] ; then chmod +x "$GLOBALS_FILE" . "$GLOBALS_FILE" @@ -36,7 +48,7 @@ fi # 02. Local script variables # =================================================== export STEAMCMD_USER=steam -export MODLISTS="$PWD/modlists" +export MODLISTS="$WORKING_DIR/modlists" export LOCAL_STOCK="$HOME/stock" export LOCAL_STOCK_GAME="$LOCAL_STOCK/DayZ"