Merge pull request #55 from joedwards32/53-metamod-gameinfogi-and-pre-hooks
Added basic support for pre/post hooks
This commit is contained in:
commit
47b89294f1
5 changed files with 39 additions and 0 deletions
11
README.md
11
README.md
|
@ -104,6 +104,17 @@ TV_MAXRATE=0 (Max CSTV spectator bandwidth rate allowed, 0 == unl
|
||||||
TV_DELAY=0 (CSTV broadcast delay in seconds)
|
TV_DELAY=0 (CSTV broadcast delay in seconds)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Customizing this Container
|
||||||
|
|
||||||
|
## Pre and Post Hooks
|
||||||
|
|
||||||
|
The container includes two scripts for executing custom actions:
|
||||||
|
|
||||||
|
* `/home/steam/cs2-dedicated/pre.sh` is executed before the CS2 server starts
|
||||||
|
* `/home/steam/cs2-dedicated/post.sh` is executed after the CS2 server stops
|
||||||
|
|
||||||
|
When using a persient volume mounted at `/home/steam/cs2-dedicated/` you may edit these scripts to perform custom actions, such as enabling metamod.
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
|
|
||||||
This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG!
|
This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG!
|
||||||
|
|
|
@ -18,6 +18,8 @@ ENV CFG_URL https://raw.githubusercontent.com/joedwards32/CS2/settings.tgz
|
||||||
|
|
||||||
COPY etc/entry.sh "${HOMEDIR}/entry.sh"
|
COPY etc/entry.sh "${HOMEDIR}/entry.sh"
|
||||||
COPY etc/server.cfg "/etc/server.cfg"
|
COPY etc/server.cfg "/etc/server.cfg"
|
||||||
|
COPY etc/pre.sh "/etc/pre.sh"
|
||||||
|
COPY etc/post.sh "/etc/post.sh"
|
||||||
|
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
# Install, update & upgrade packages
|
# Install, update & upgrade packages
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Create App Dir
|
||||||
mkdir -p "${STEAMAPPDIR}" || true
|
mkdir -p "${STEAMAPPDIR}" || true
|
||||||
|
|
||||||
# Download Updates
|
# Download Updates
|
||||||
|
@ -27,6 +29,14 @@ sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \
|
||||||
-e "s/{{TV_DELAY}}/${TV_DELAY}/g" \
|
-e "s/{{TV_DELAY}}/${TV_DELAY}/g" \
|
||||||
"${STEAMAPPDIR}"/game/csgo/cfg/server.cfg
|
"${STEAMAPPDIR}"/game/csgo/cfg/server.cfg
|
||||||
|
|
||||||
|
# Install hooks
|
||||||
|
if [[ ! -f "${STEAMAPPDIR}/pre.sh" ]] ; then
|
||||||
|
cp /etc/pre.sh "${STEAMAPPDIR}/pre.sh"
|
||||||
|
fi
|
||||||
|
if [[ ! -f "${STEAMAPPDIR}/post.sh" ]] ; then
|
||||||
|
cp /etc/post.sh "${STEAMAPPDIR}/post.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
# Rewrite Config Files
|
# Rewrite Config Files
|
||||||
|
|
||||||
if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then
|
if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then
|
||||||
|
@ -42,6 +52,9 @@ fi
|
||||||
# Switch to server directory
|
# Switch to server directory
|
||||||
cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64"
|
cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64"
|
||||||
|
|
||||||
|
# Pre Hook
|
||||||
|
bash "${STEAMAPPDIR}/pre.sh"
|
||||||
|
|
||||||
# Construct server arguments
|
# Construct server arguments
|
||||||
|
|
||||||
if [[ -z $CS2_GAMEALIAS ]]; then
|
if [[ -z $CS2_GAMEALIAS ]]; then
|
||||||
|
@ -70,3 +83,6 @@ eval "./cs2" -dedicated \
|
||||||
+rcon_password "${CS2_RCONPW}" \
|
+rcon_password "${CS2_RCONPW}" \
|
||||||
+sv_password "${CS2_PW}" \
|
+sv_password "${CS2_PW}" \
|
||||||
"${CS2_ADDITIONAL_ARGS}"
|
"${CS2_ADDITIONAL_ARGS}"
|
||||||
|
|
||||||
|
# Post Hook
|
||||||
|
bash "${STEAMAPPDIR}/post.sh"
|
||||||
|
|
5
bullseye/etc/post.sh
Executable file
5
bullseye/etc/post.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# POST HOOK
|
||||||
|
# Make your customisation here
|
||||||
|
echo "post-hook: noop"
|
5
bullseye/etc/pre.sh
Executable file
5
bullseye/etc/pre.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# PRE HOOK
|
||||||
|
# Make your customisation here
|
||||||
|
echo "pre-hook: noop"
|
Loading…
Add table
Add a link
Reference in a new issue