diff --git a/Dockerfile b/Dockerfile index 30c383c..9e281dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,8 +21,6 @@ ENV STEAM_PATH="/home/steam" \ \ USE_MY_REPLACER_CONFIG=false -VOLUME "$SERVER_PATH" - ENTRYPOINT ["./home/entrypoint.sh"] COPY ["entrypoint.sh", "installAndMountAddons.sh", "forceWorkshopDownload.sh", "experimental.sh", "/home/"] @@ -34,10 +32,14 @@ RUN dpkg --add-architecture i386 && \ groupadd -g $GROUP_ID $DOCKER_USER && \ useradd -d /home/steam/ -g $GROUP_ID -u $USER_ID -m $DOCKER_USER && \ chown "$DOCKER_USER:$DOCKER_USER" /home/entrypoint.sh && \ + mkdir -p "$SERVER_PATH" && \ + chown -R "$DOCKER_USER:$DOCKER_USER" "$STEAM_PATH" && \ chmod a=rx /home/entrypoint.sh && \ chmod a=rx /home/installAndMountAddons.sh && \ chmod a=rx /home/forceWorkshopDownload.sh && \ chmod a=rx /home/experimental.sh && \ ulimit -n 2048 -USER "$USER_ID:$GROUP_ID" \ No newline at end of file +USER "$USER_ID:$GROUP_ID" + +VOLUME "$SERVER_PATH" \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 9598c5b..ddce9d9 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/bash + echo "starting entrypoint.sh" set -e @@ -7,7 +8,7 @@ if [ "$1" = "testing" ]; then DEBUG_MODE=true fi -echo "installing / updating steamcmd" +echo "installing / updating steamcmd in $STEAM_PATH" cd "$STEAM_PATH" wget -q -O - "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar -zxvf - @@ -21,6 +22,7 @@ if [ -e "${STEAM_PATH}/server/garrysmod/cache" ]; then fi echo "testing steamcmd" +chmod ug=rwx,o= steamcmd.sh ./steamcmd.sh +login anonymous +quit echo "installing / validating ttt" @@ -35,11 +37,16 @@ cd "$STEAM_PATH" echo '[error][2] <= printed' && \ ./steamcmd.sh +login anonymous +force_install_dir "$STEAM_PATH/server/" +app_update 4020 validate +quit) -bash experimental.sh -bash installAndMountAddons.sh -bash forceWorkshopDownload.sh - echo "processing scripts before start" + +echo "experimental.sh" +bash /home/experimental.sh +echo "forceWorkshopDownload.sh" +bash /home/forceWorkshopDownload.sh +echo "installAndMountAddons.sh" +bash /home/installAndMountAddons.sh + + if [ -e "$SERVER_PATH/custom.sh" ]; then echo "existing: $SERVER_PATH/custom.sh" bash "$SERVER_PATH/custom.sh" @@ -52,6 +59,7 @@ cd "$STEAM_PATH/server/" trap 'pkill -15 srcds_run' SIGTERM if [ "$DEBUG_MODE" != "true" ]; then + chmod ug=rwx,o= srcds_run ./srcds_run -console -game garrysmod +gamemode terrortown "$@" & wait "$!" else diff --git a/experimental.sh b/experimental.sh index 51c7081..1b4e6d0 100644 --- a/experimental.sh +++ b/experimental.sh @@ -4,14 +4,14 @@ set -e #create default server.config #TODO don't miss to change to master! -if [ ! -e "{$SERVER_PATH}/garrysmod/cfg/server.cfg" ]; then - mkdir -p "{$SERVER_PATH}/garrysmod/cfg" - wget -O "{$SERVER_PATH}/garrysmod/cfg/server.cfg" "https://raw.githubusercontent.com/jusito/docker-ttt/develop/server.cfg" +if [ ! -e "${SERVER_PATH}/garrysmod/cfg/server.cfg" ]; then + mkdir -p "${SERVER_PATH}/garrysmod/cfg" + wget -O "${SERVER_PATH}/garrysmod/cfg/server.cfg" "https://raw.githubusercontent.com/jusito/docker-ttt/develop/server.cfg" fi #this is a simple option for myself, but you can use it too if [ "$USE_MY_REPLACER_CONFIG" = "true" ]; then - mkdir -p "{$SERVER_PATH}/garrysmod/data/jusito_ttt_entity_replace" - wget -O "{$SERVER_PATH}/garrysmod/data/jusito_ttt_entity_replace/config.txt" "https://raw.githubusercontent.com/jusito/ttt_entity_replace/master/config.txt.example_fas2" + mkdir -p "${SERVER_PATH}/garrysmod/data/jusito_ttt_entity_replace" + wget -O "${SERVER_PATH}/garrysmod/data/jusito_ttt_entity_replace/config.txt" "https://raw.githubusercontent.com/jusito/ttt_entity_replace/master/config.txt.example_fas2" fi diff --git a/installAndMountAddons.sh b/installAndMountAddons.sh index da653ca..3059816 100644 --- a/installAndMountAddons.sh +++ b/installAndMountAddons.sh @@ -40,9 +40,9 @@ mount=${mount}$'}' if [ ! -e "${SERVER_PATH}/garrysmod/cfg" ]; then mkdir -p "${SERVER_PATH}/garrysmod/cfg" fi -if [ -e "${SERVER_PATH}/garrysmod/cfg" ]; then - rm "${SERVER_PATH}/garrysmod/cfg" +if [ -e "${SERVER_PATH}/garrysmod/cfg/mount.cfg" ]; then + rm "${SERVER_PATH}/garrysmod/cfg/mount.cfg" fi -touch "${SERVER_PATH}/garrysmod/cfg" +touch "${SERVER_PATH}/garrysmod/cfg/mount.cfg" echo "$mount" > "${SERVER_PATH}/garrysmod/cfg/mount.cfg"