diff --git a/README.md b/README.md index 3933b42..9f64c25 100644 --- a/README.md +++ b/README.md @@ -165,13 +165,13 @@ mp_maxrounds 16 // Shorter games ## Customisation Bundle -The container can be instructed to download a extract a Tar Gzip of configuration files and other customisations from a given URL. +The container can be instructed to download a extract a Tar Gzip bundle, Tar or Zip archive of configuration files and other customisations from a given URL. ```dockerfile -CS2_CFG_URL="" (HTTP/HTTPS URL to fetch a Tar Gzip bundle of configuration files/mods) +CS2_CFG_URL="" (HTTP/HTTPS URL to fetch a Tar Gzip bundle, Tar or Zip archive of configuration files/mods) ``` -See [examples](https://github.com/joedwards32/CS2/blob/main/examples/cs2.cfg.tgz) for a correctly formatted Tar Gzip customisation bundle. +See [examples](https://github.com/joedwards32/CS2/blob/main/examples/cs2.cfg.tgz) for a correctly formatted Tar Gzip customisation bundle, the same format applies to all archive types. # Credits diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index f2ccc46..223e180 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -35,7 +35,32 @@ fi # Download and extract custom config bundle if [[ ! -z $CS2_CFG_URL ]]; then echo "Downloading config pack from ${CS2_CFG_URL}" - wget -qO- "${CS2_CFG_URL}" | tar xvzf - -C "${STEAMAPPDIR}" + + TEMP_DIR=$(mktemp -d) + TEMP_FILE="${TEMP_DIR}/$(basename ${CS2_CFG_URL})" + wget -qO "${TEMP_FILE}" "${CS2_CFG_URL}" + + case "${TEMP_FILE}" in + *.zip) + echo "Extracting ZIP file..." + unzip -q "${TEMP_FILE}" -d "${STEAMAPPDIR}" + ;; + *.tar.gz | *.tgz) + echo "Extracting TAR.GZ or TGZ file..." + tar xvzf "${TEMP_FILE}" -C "${STEAMAPPDIR}" + ;; + *.tar) + echo "Extracting TAR file..." + tar xvf "${TEMP_FILE}" -C "${STEAMAPPDIR}" + ;; + *) + echo "Unsupported file type" + rm -rf "${TEMP_DIR}" + exit 1 + ;; + esac + + rm -rf "${TEMP_DIR}" fi # Rewrite Config Files diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 535f3b7..af3b257 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -16,7 +16,7 @@ services: - CS2_PW=changeme # (CS2 server password) - CS2_MAXPLAYERS=10 # (Max players) - CS2_ADDITIONAL_ARGS # (Optional additional arguments to pass into cs2) - - CS2_CFG_URL # HTTP/HTTPS URL to fetch a Tar Gzip bundle of configuration files/mods + - CS2_CFG_URL # HTTP/HTTPS URL to fetch a Tar Gzip bundle, Tar or Zip archive of configuration files/mods # Game modes - CS2_GAMEALIAS # (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - CS2_GAMETYPE=0 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers)