diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index bca0dad..1f08f5a 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -4,6 +4,12 @@ sleep 1 # Make internal Docker IP address available to processes. export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +# Retain gameinfo.gi file - CS2 updates tend to reset this file to default, so we try to retain it. +GAMEINFO_FILE="/home/container/game/csgo/gameinfo.gi" +if [ -f "${GAMEINFO_FILE}" ]; then + mv "$GAMEINFO_FILE" "$GAMEINFO_FILE.tmp" +fi + # Update Source Server if [ ! -z ${SRCDS_APPID} ]; then if [ ${SRCDS_STOP_UPDATE} -eq 0 ]; then @@ -59,33 +65,14 @@ if [ ! -z ${SRCDS_APPID} ]; then fi fi +# Restore gameinfo.gi file +if [ -f "${GAMEINFO_FILE}" ]; then + rm "$GAMEINFO_FILE" && mv "$GAMEINFO_FILE.tmp" "$GAMEINFO_FILE" +fi + # Replace Startup Variables MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` echo ":/home/container$ ${MODIFIED_STARTUP}" -# Edit /home/container/game/csgo/gameinfo.gi to add MetaMod path -# Credit: https://github.com/ghostcap-gaming/ACMRS-cs2-metamod-update-fix/blob/main/acmrs.sh -GAMEINFO_FILE="/home/container/game/csgo/gameinfo.gi" -GAMEINFO_ENTRY=" Game csgo/addons/metamod" -if [ -f "${GAMEINFO_FILE}" ]; then - if grep -Fxq "$GAMEINFO_ENTRY" "$GAMEINFO_FILE"; then - echo "File gameinfo.gi already configured. No changes were made." - else - awk -v new_entry="$GAMEINFO_ENTRY" ' - BEGIN { found=0; } - // { - if (found) { - print new_entry; - found=0; - } - print; - } - /Game_LowViolence/ { found=1; } - ' "$GAMEINFO_FILE" > "$GAMEINFO_FILE.tmp" && mv "$GAMEINFO_FILE.tmp" "$GAMEINFO_FILE" - - echo "The file ${GAMEINFO_FILE} has been configured successfully." - fi -fi - # Run the Server eval ${MODIFIED_STARTUP} \ No newline at end of file