Skip to content

Commit

Permalink
Resolve #18, edit gameinfo.gi for MetaMod on server restart - Merge p…
Browse files Browse the repository at this point in the history
…ull request #26 from 1zc/dev

Resolve #18, edit gameinfo.gi for MetaMod on server restart
  • Loading branch information
Liam authored Jan 1, 2024
2 parents a97874a + 0c824d1 commit 9d6c845
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Shellcheck"
permissions: {}
on:
pull_request:
types: [opened, reopened]
push:
branches:
- main
- dev
jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -s bash
with:
severity: error
scandir: './docker'
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# CS2 on Pterodactyl

Docker image and Pterodactyl egg to prepare for upcoming CS (CS:GO/CS2) updates. The Docker image is based on the Valve provided SteamRT3 Sniper package, with the Pterodactyl egg featuring a few exposed variables such as Beta selection variables and allowing for skipping SteamCMD on launch (i.e, preventing updates). This should allow existing CSGO servers to easily stay on the opt-in CS:GO branch once CS2 releases.
Docker image and Pterodactyl egg to run CS2 and CS:GO Servers on Valve's SteamRT3 platform. The Docker image is based on the Valve provided SteamRT3 Sniper package, with the Pterodactyl egg featuring a few exposed variables such as Beta selection variables and allowing for skipping SteamCMD on launch (i.e, preventing updates). This should allow existing CSGO servers to easily stay on the opt-in CS:GO branch (or any particular version of CS:GO) once CS2 releases.

This setup is very similar to the stock Pterodactyl Source server setup, so things should be familiar once imported.

The underlying Docker image is based on Valve's Steam Runtime 3 (Sniper), which should be able to run both CS:GO and CS2 without any issues. The image also can be rebuilt easily as soon as Valve updates their base SteamRT3 image, so we can stay on top of their updates without worrying too much about it.

The CS2 image also ensures the `gameinfo.gi` file is configured for MetaMod automatically on server restart, which should be convenient for modded servers.

## How to use

- Download egg(s) from the `/pterodactyl` directory.
Expand All @@ -20,6 +22,11 @@ The Docker image is hosted on the GitHub Container Registry. You can grab it fro
ghcr.io/1zc/steamrt3-pterodactyl:latest
```

The development branch contains upcoming changes that are currently being tested before being merged into main. If you'd like to use that image instead:
```
ghcr.io/1zc/steamrt3-pterodactyl:dev
```

Alternatively, you can find a full list of builds here: https://github.com/1zc/CS2-Pterodactyl/packages

## Frequent Issues
Expand All @@ -28,10 +35,12 @@ Alternatively, you can find a full list of builds here: https://github.com/1zc/C
- Make sure you are using the correct IP address, and then try enabling "Force Outgoing IP" in the egg's configuration in your Pterodactyl Panel admin section.
- `net_public_adr` doesn't work on CS2 at the time of writing this, so the above is a (hopefully) temporary workaround.
- What operating systems can I run my CS2 server on?
- At the moment, it appears CS2 will run on the following without issues:
- At the moment, it appears CS2 will run on the following host operating systems without issues:
- Ubuntu 20.04+
- Debian 11+
- *If you find any more, please open an issue and I'll add it to this list!*
- My RCON doesn't work!
- Try setting your IP address in the launch command as `0.0.0.0` instead of the actual IP.

## General Tips

Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ LABEL org.opencontainers.image.source="https://github.com/1zc/cs2-pterodac
# Prep OS
RUN mkdir -p /etc/sudoers.d && echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/flatdeb && chmod 0440 /etc/sudoers.d/flatdeb
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y iproute2 && apt-get clean
USER container
ENV USER=container HOME=/home/container
WORKDIR /home/container
Expand Down
24 changes: 24 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ if [ ! -z ${SRCDS_APPID} ]; then
fi
fi

# 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 -q "Game[[:blank:]]*csgo\/addons\/metamod" "$GAMEINFO_FILE"; then # match any whitespace
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 for MetaMod successfully."
fi
fi

# Replace Startup Variables
MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
echo ":/home/container$ ${MODIFIED_STARTUP}"
Expand Down

0 comments on commit 9d6c845

Please sign in to comment.