Merge pull request #3 from ich777/beta

Updated to support login
This commit is contained in:
2019-04-23 18:10:56 +02:00
committed by GitHub
3 changed files with 53 additions and 11 deletions

View File

@@ -12,8 +12,11 @@ ENV GAME_ID="template"
ENV GAME_NAME="template"
ENV GAME_PARAMS="template"
ENV GAME_PORT=27015
ENV VALIDATE=""
ENV UID=99
ENV GID=100
ENV USERNAME=""
ENV PASSWRD=""
RUN mkdir $DATA_DIR
RUN mkdir $STEAMCMD_DIR
@@ -24,7 +27,7 @@ RUN chown -R steam $DATA_DIR
RUN ulimit -n 2048
ADD /scripts/ /opt/scripts/
RUN chmod -R 774 /opt/scripts/
RUN chmod -R 770 /opt/scripts/
RUN chown -R steam /opt/scripts
USER steam

View File

@@ -12,6 +12,11 @@ This Docker will download and install SteamCMD. It will also install Counter-Str
| UID | User Identifier | 99 |
| GID | Group Identifier | 100 |
| GAME_PORT | Port the server will be running on | 27015 |
| VALIDATE | Validates the game data | true |
| USERNAME | Leave blank for anonymous login | blank |
| PASSWRD | Leave blank for anonymous login | blank |
***ATTENTION: You have to disable Steam Guard for games that require authentication, Steam recommends to create a seperate account for dedicated servers***
>**NOTE** GAME_ID values can be found [here](https://developer.valvesoftware.com/wiki/Dedicated_Servers_List)

View File

@@ -1,26 +1,60 @@
#!/bin/bash
if [ ! -f ${STEAMCMD_DIR}/steamcmd.sh ]; then
echo "Steamcmd not found!"
echo "SteamCMD not found!"
wget -q -O ${STEAMCMD_DIR}/steamcmd_linux.tar.gz http://media.steampowered.com/client/steamcmd_linux.tar.gz
tar --directory ${STEAMCMD_DIR} -xvzf /serverdata/steamcmd/steamcmd_linux.tar.gz
rm ${STEAMCMD_DIR}/steamcmd_linux.tar.gz
fi
echo "---Update steamcmd---"
${STEAMCMD_DIR}/steamcmd.sh \
echo "---Update SteamCMD---"
if [ "${USERNAME}" == "" ]; then
${STEAMCMD_DIR}/steamcmd.sh \
+login anonymous \
+quit
echo "---Update server---"
${STEAMCMD_DIR}/steamcmd.sh \
+login anonymous \
+force_install_dir $SERVER_DIR \
+app_update $GAME_ID \
else
${STEAMCMD_DIR}/steamcmd.sh \
+login $USERNAME $PASSWRD \
+quit
fi
echo "---Update Server---"
if [ "${USERNAME}" == "" ]; then
if [ "${VALIDATE}" == "true" ]; then
${STEAMCMD_DIR}/steamcmd.sh \
+login anonymous \
+force_install_dir $SERVER_DIR \
+app_update $GAME_ID validate \
+quit
else
${STEAMCMD_DIR}/steamcmd.sh \
+login anonymous \
+force_install_dir $SERVER_DIR \
+app_update $GAME_ID \
+quit
fi
else
if [ "${VALIDATE}" == "true" ]; then
${STEAMCMD_DIR}/steamcmd.sh \
+login $USERNAME $PASSWRD \
+force_install_dir $SERVER_DIR \
+app_update $GAME_ID validate \
+quit
else
${STEAMCMD_DIR}/steamcmd.sh \
+login $USERNAME $PASSWRD \
+force_install_dir $SERVER_DIR \
+app_update $GAME_ID \
+quit
fi
fi
echo "---Prepare Server---"
mkdir ${DATA_DIR}/.steam/sdk32
cp -R ${SERVER_DIR}/bin/* ${DATA_DIR}/.steam/sdk32/
chmod -R 770 ${DATA_DIR}
echo "---Start Server---"
${SERVER_DIR}/srcds_run -game $GAME_NAME $GAME_PARAMS -console +port $GAME_PORT