From 9fb3504baca4c1dbdf0d0949171983599f7dcd65 Mon Sep 17 00:00:00 2001 From: Daniel Ceregatti Date: Thu, 27 Jun 2024 14:34:21 -0700 Subject: [PATCH 1/3] Ensure that the mpmissions being used has all the files we need. Some don't, like Namalsk, which lacks cfggameplay.json. Account for default ports. Another consequence from the bad merge. --- files/bin/dz-common | 10 ++++++++++ files/mods/{enoch => default}/map.env | 4 ++-- server/bin/dz | 21 ++++++++++++--------- web/bin/dz | 4 ++++ 4 files changed, 28 insertions(+), 11 deletions(-) rename files/mods/{enoch => default}/map.env (71%) diff --git a/files/bin/dz-common b/files/bin/dz-common index 1fd973b..2929578 100755 --- a/files/bin/dz-common +++ b/files/bin/dz-common @@ -6,6 +6,16 @@ set -eEa # The steam query port is set in serverDZ.cfg. # Server port. Set these in the .env file for the container. +if [[ ${SERVER_PORT} = "" ]] +then + export SERVER_PORT=2302 +fi + +if [[ ${RCON_PORT} = "" ]] +then + export RCON_PORT=2303 +fi + export port=${SERVER_PORT} export rcon_port=${RCON_PORT} diff --git a/files/mods/enoch/map.env b/files/mods/default/map.env similarity index 71% rename from files/mods/enoch/map.env rename to files/mods/default/map.env index 7c2a888..1fc8223 100644 --- a/files/mods/enoch/map.env +++ b/files/mods/default/map.env @@ -1,6 +1,6 @@ #!/usr/bin/env bash -MAP="Enoch" +MAP="Default Maps" DIR="DayZ-Central-Economy" REPO="https://github.com/BohemiaInteractive/${DIR}.git" -MPDIR="dayzOffline.enoch" +MPDIR="dayzOffline.*" diff --git a/server/bin/dz b/server/bin/dz index 98f8349..1142b0b 100755 --- a/server/bin/dz +++ b/server/bin/dz @@ -138,15 +138,18 @@ mergexml(){ # Copy the pristine files from upstream echo -e "${green}Copying upstream files into local mpmissions for map ${MAP}${default}": - find /mpmissions/${MAP} \( \ - -name "cfgeconomycore.xml" \ - -o -name "cfgenvironment.xml" \ - -o -name "cfgeventgroups.xml" \ - -o -name "cfgeventspawns.xml" \ - -o -name "cfggameplay.json" \ - -o -name "cfgweather.xml" \ - -o -name "init.c" \ - \) -exec cp -v {} ${SERVER_FILES}{} \; + # Not all maps have all files, so we need to check for their existence before copying them + for i in "cfgeconomycore.xml" "cfgenvironment.xml" "cfgeventgroups.xml" "cfgeventspawns.xml" "cfggameplay.json" "cfgweather.xml" "init.c" + do + if [ -f /mpmissions/${MAP}/${i} ] + then + cp -v /mpmissions/${MAP}/${i} ${SERVER_FILES}/${i} + else + # Copy it from the Chernarus map + echo "The map ${MAP} does not have a ${i} file, copying from Chernarus..." + cp -v /mpmissions/dayzOffline.chernarusplus/${i} ${SERVER_FILES}/${i} + fi + done # Same for any files in the db subdirectory we may modify find /mpmissions/${MAP}/db \( \ diff --git a/web/bin/dz b/web/bin/dz index 047ac3d..9e70838 100755 --- a/web/bin/dz +++ b/web/bin/dz @@ -190,6 +190,10 @@ install(){ printf "[ ${yellow}DayZ${default} ] Downloading DayZ Server-Files!\n" dologin ${STEAMCMD} +force_install_dir ${SERVER_FILES} +login "${steamlogin}" +app_update "${release_server_appid}" validate +quit + # This installs the mpmissions for charnarusplus and enoch (AKA Livonia) from github. The game once allowed the full server + # to be downloaded, but now you get the server without any mpmissions. This is a workaround. + echo "Installing mpmissions for ChernarusPlus and Livonia from github..." + map default else printf "[ ${lightblue}DayZ${default} ] The server is already installed.\n" fi From 8cf493e8d513a123599f8f5e4c9163ec538354d3 Mon Sep 17 00:00:00 2001 From: Daniel Ceregatti Date: Fri, 28 Jun 2024 20:56:57 -0700 Subject: [PATCH 2/3] Fix bug where upstream files were not being copied to the correct location upon server start. --- server/bin/dz | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/bin/dz b/server/bin/dz index 1142b0b..3a813f9 100755 --- a/server/bin/dz +++ b/server/bin/dz @@ -143,11 +143,11 @@ mergexml(){ do if [ -f /mpmissions/${MAP}/${i} ] then - cp -v /mpmissions/${MAP}/${i} ${SERVER_FILES}/${i} + cp -v /mpmissions/${MAP}/${i} ${MPMISSIONS}/${MAP}/${i} else # Copy it from the Chernarus map echo "The map ${MAP} does not have a ${i} file, copying from Chernarus..." - cp -v /mpmissions/dayzOffline.chernarusplus/${i} ${SERVER_FILES}/${i} + cp -v /mpmissions/dayzOffline.chernarusplus/${i} ${MPMISSIONS}/${MAP}/${i} fi done From 3ae7bc4454f43d33fd16c47d34d5331e326b5359 Mon Sep 17 00:00:00 2001 From: Daniel Ceregatti Date: Sun, 30 Jun 2024 11:53:27 -0700 Subject: [PATCH 3/3] Stop doing stupid shit. --- server/bin/dz | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/bin/dz b/server/bin/dz index 3a813f9..d17e0ea 100755 --- a/server/bin/dz +++ b/server/bin/dz @@ -5,7 +5,7 @@ source dz-common # Server container base directories MPMISSIONS="${SERVER_FILES}/mpmissions" -mkdir -p ${SERVER_PROFILE}/battleye +mkdir -p "${SERVER_PROFILE}"/battleye # Server configuration file SERVER_CFG_FILE="serverDZ.cfg" @@ -381,10 +381,8 @@ start(){ echo "Caught SIGTERM/SIGINT..." exit 0 ' SIGTERM SIGINT - while [ true ] - do - sleep 1 - done + tail -f /dev/null & + wait $! exit 0 fi # Clean up from previous runs