Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config overriding & steamcmd version #72

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/zomboid-dedicated-server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#######################################################################

# Base Image
ARG BASE_IMAGE="docker.io/renegademaster/steamcmd-minimal:1.1.2"
ARG BASE_IMAGE="docker.io/renegademaster/steamcmd-minimal:2.0.0"

FROM ${BASE_IMAGE}

Expand Down
33 changes: 20 additions & 13 deletions src/run_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,47 +62,54 @@ function start_server() {
printf "\n### Project Zomboid Server stopped.\n"
}

###
#
# UPD: fix config override
# see: https://unix.stackexchange.com/questions/109625/shell-scripting-z-and-n-options-with-if
#
###

function apply_postinstall_config() {
printf "\n### Applying Post Install Configuration...\n"

# Set the Autosave Interval
"$EDIT_CONFIG" "$SERVER_CONFIG" "SaveWorldEveryMinutes" "$AUTOSAVE_INTERVAL"
[ -n "$AUTOSAVE_INTERVAL" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "SaveWorldEveryMinutes" "$AUTOSAVE_INTERVAL"

# Set the default Server Port
"$EDIT_CONFIG" "$SERVER_CONFIG" "DefaultPort" "$DEFAULT_PORT"
[ -n "$DEFAULT_PORT" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "DefaultPort" "$DEFAULT_PORT"

# Set the default extra UDP Port
"$EDIT_CONFIG" "$SERVER_CONFIG" "UDPPort" "$UDP_PORT"
[ -n "$UDP_PORT" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "UDPPort" "$UDP_PORT"

# Set the Max Players
"$EDIT_CONFIG" "$SERVER_CONFIG" "MaxPlayers" "$MAX_PLAYERS"
[ -n "$MAX_PLAYERS" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "MaxPlayers" "$MAX_PLAYERS"

# Set the Mod names
"$EDIT_CONFIG" "$SERVER_CONFIG" "Mods" "$MOD_NAMES"
[ -n "$MOD_NAMES" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "Mods" "$MOD_NAMES"

# Set the Map names
"$EDIT_CONFIG" "$SERVER_CONFIG" "Map" "$MAP_NAMES"
[ -n "$MAP_NAMES" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "Map" "$MAP_NAMES"

# Set the Mod Workshop IDs
"$EDIT_CONFIG" "$SERVER_CONFIG" "WorkshopItems" "$MOD_WORKSHOP_IDS"
[ -n "$MOD_WORKSHOP_IDS" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "WorkshopItems" "$MOD_WORKSHOP_IDS"

# Set the Pause on Empty Server
"$EDIT_CONFIG" "$SERVER_CONFIG" "PauseEmpty" "$PAUSE_ON_EMPTY"
[ -n "$PAUSE_ON_EMPTY" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "PauseEmpty" "$PAUSE_ON_EMPTY"

# Set the Server Publicity status
"$EDIT_CONFIG" "$SERVER_CONFIG" "Open" "$PUBLIC_SERVER"
[ -n "$PUBLIC_SERVER" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "Open" "$PUBLIC_SERVER"

# Set the Server RCON Password
"$EDIT_CONFIG" "$SERVER_CONFIG" "RCONPassword" "$RCON_PASSWORD"
[ -n "$RCON_PASSWORD" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "RCONPassword" "$RCON_PASSWORD"

# Set the Server RCON Port
"$EDIT_CONFIG" "$SERVER_CONFIG" "RCONPort" "$RCON_PORT"
[ -n "$RCON_PORT" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "RCONPort" "$RCON_PORT"

# Set the Server Name
"$EDIT_CONFIG" "$SERVER_CONFIG" "PublicName" "$SERVER_NAME"
[ -n "$SERVER_NAME" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "PublicName" "$SERVER_NAME"

# Set the Server Password
"$EDIT_CONFIG" "$SERVER_CONFIG" "Password" "$SERVER_PASSWORD"
[ -n "$SERVER_PASSWORD" ] && "$EDIT_CONFIG" "$SERVER_CONFIG" "Password" "$SERVER_PASSWORD"

# Set the maximum amount of RAM for the JVM
sed -i "s/-Xmx.*/-Xmx${MAX_RAM}\",/g" "${SERVER_VM_CONFIG}"
Expand Down