From d6cb89512018be123846f6be57acec7a8dc1b8b4 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 22 Feb 2024 12:11:30 +0000 Subject: [PATCH] Add support for steamcmd app validation --- README.md | 8 ++++++++ bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 8 +++++++- examples/docker-compose.yml | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a3571b5..300ceb7 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,14 @@ CS2_LOG_ITEMS=0 (Turns item logging on/off: 0=off, 1=on) # Customizing this Container +## Validating Game Files + +If you break the game through your customisations and want steamcmd to validate and redownload then set the `STEAMAPPVALIDATE` environment variable to `1`: + +```dockerfile +STEAMAPPVALIDATE=0 (0=skip validation, 1=validate game files) +``` + ## Pre and Post Hooks The container includes two scripts for executing custom actions: diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 0c2e518..d712b8f 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -11,6 +11,7 @@ LABEL maintainer="joedwards32@gmail.com" ENV STEAMAPPID 730 ENV STEAMAPP cs2 ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" +ENV STEAMAPPVALIDATE 0 COPY etc/entry.sh "${HOMEDIR}/entry.sh" COPY etc/server.cfg "/etc/server.cfg" diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index fc1a21d..aaf8b83 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -5,9 +5,15 @@ mkdir -p "${STEAMAPPDIR}" || true # Download Updates +if [[ "$STEAMAPPVALIDATE" -eq 1 ]]; then + VALIDATE="validate" +else + VALIDATE="" +fi + bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +login anonymous \ - +app_update "${STEAMAPPID}" \ + +app_update "${STEAMAPPID}" "${VALIDATE}"\ +quit # steamclient.so fix diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 269f5a7..8084973 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -6,6 +6,7 @@ services: environment: # Server configuration - SRCDS_TOKEN # Game Server Token from https://steamcommunity.com/dev/managegameservers + - STEAMAPPVALIDATE=0 # (0 - no validation, 1 - enable validation) - CS2_SERVERNAME=changeme # (Set the visible name for your private server) - CS2_CHEATS=0 # (0 - disable cheats, 1 - enable cheats) - CS2_PORT=27015 # (CS2 server listen port tcp_udp)