Skip to content

Commit

Permalink
[DayZ] Image Cleanup (#247)
Browse files Browse the repository at this point in the history
* [DayZ] Image Cleanup

- Removed `numactl` dependency as it seems SteamCMD updated and resolved its crashing issues on Linux when logging in with a real account.
- Added clearing of SteamCMD appworkshop cache before mod downloads to avoid potential failures (at least until I implement a better method using symlinks for mod folders).
- General cleanup of text and labels.

* Fix missing `WORKSHOP_DIR` global var
  • Loading branch information
lilkingjr1 committed Jun 6, 2024
1 parent 5f7b002 commit 2e3436f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
14 changes: 7 additions & 7 deletions games/dayz/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM --platform=$BUILDPLATFORM debian:bullseye-slim
FROM --platform=$TARGETOS/$TARGETARCH debian:bookworm-slim

LABEL author="David Wolfe (Red-Thirten)" maintainer="rehlmgaming@gmail.com"
LABEL author="David Wolfe (Red-Thirten)" maintainer="red_thirten@yahoo.com"

LABEL org.opencontainers.image.source="https://github.com/parkervcp/yolks"
LABEL org.opencontainers.image.source="https://github.com/pelican-eggs/yolks"
LABEL org.opencontainers.image.licenses=MIT

## Update base packages and install dependencies
Expand All @@ -17,7 +17,6 @@ RUN dpkg --add-architecture i386 \
iproute2 \
gettext-base \
ca-certificates \
numactl \
libssl-dev \
lib32gcc-s1 \
libsdl2-2.0-0 \
Expand All @@ -33,7 +32,7 @@ RUN dpkg --add-architecture i386 \
RUN update-locale lang=en_US.UTF-8 \
&& dpkg-reconfigure --frontend noninteractive locales

## Prepare NSS Wrapper for the entrypoint as a workaround for Arma 3 requiring a valid UID
## Prepare NSS Wrapper for the entrypoint as a workaround for DayZ requiring a valid UID
ENV NSS_WRAPPER_PASSWD=/tmp/passwd NSS_WRAPPER_GROUP=/tmp/group
RUN touch ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP} \
&& chgrp 0 ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP} \
Expand All @@ -46,9 +45,10 @@ USER container
ENV USER=container HOME=/home/container
WORKDIR /home/container

STOPSIGNAL SIGINT
STOPSIGNAL SIGINT

## Copy over and execute entrypoint.sh via Tini
COPY --chown=container:container ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
CMD ["/entrypoint.sh"]
22 changes: 14 additions & 8 deletions games/dayz/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/bin/bash

## File: Pterodactyl DayZ SA Image - entrypoint.sh
## File: DayZ Image - entrypoint.sh
## Author: David Wolfe (Red-Thirten)
## Contributors: Aussie Server Hosts (https://aussieserverhosts.com/)
## Date: 2022/11/27
## Date: 2024/06/05
## License: MIT License

## === CONSTANTS ===
STEAMCMD_DIR="./steamcmd" # SteamCMD's directory containing steamcmd.sh
WORKSHOP_DIR="./Steam/steamapps/workshop" # SteamCMD's directory containing workshop downloads
STEAMCMD_LOG="${STEAMCMD_DIR}/steamcmd.log" # Log file for SteamCMD
GAME_ID=221100 # SteamCMD ID for the DayZ SA GAME (not server). Only used for Workshop mod downloads.
GAME_ID=221100 # SteamCMD ID for the DayZ GAME (not server). Only used for Workshop mod downloads.

# Color Codes
CYAN='\033[0;36m'
Expand Down Expand Up @@ -45,9 +46,9 @@ function RunSteamCMD { #[Input: int server=0 mod=1; int id]

# Check if updating server or mod
if [[ $1 == 0 ]]; then # Server
numactl --physcpubind=+0 ${STEAMCMD_DIR}/steamcmd.sh +force_install_dir /home/container "+login \"${STEAM_USER}\" \"${STEAM_PASS}\"" +app_update $2 $extraFlags $validateServer +quit | tee -a "${STEAMCMD_LOG}"
${STEAMCMD_DIR}/steamcmd.sh +force_install_dir /home/container "+login \"${STEAM_USER}\" \"${STEAM_PASS}\"" +app_update $2 $extraFlags $validateServer +quit | tee -a "${STEAMCMD_LOG}"
else # Mod
numactl --physcpubind=+0 ${STEAMCMD_DIR}/steamcmd.sh "+login \"${STEAM_USER}\" \"${STEAM_PASS}\"" +workshop_download_item $GAME_ID $2 +quit | tee -a "${STEAMCMD_LOG}"
${STEAMCMD_DIR}/steamcmd.sh "+login \"${STEAM_USER}\" \"${STEAM_PASS}\"" +workshop_download_item $GAME_ID $2 +quit | tee -a "${STEAMCMD_LOG}"
fi

# Error checking for SteamCMD
Expand Down Expand Up @@ -104,8 +105,8 @@ function RunSteamCMD { #[Input: int server=0 mod=1; int id]
# Move the downloaded mod to the root directory, and replace existing mod if needed
mkdir -p ./@$2
rm -rf ./@$2/*
mv -f ./Steam/steamapps/workshop/content/$GAME_ID/$2/* ./@$2
rm -d ./Steam/steamapps/workshop/content/$GAME_ID/$2
mv -f ${WORKSHOP_DIR}/content/$GAME_ID/$2/* ./@$2
rm -d ${WORKSHOP_DIR}/content/$GAME_ID/$2
# Make the mods contents all lowercase
ModsLowercase @$2
# Move any .bikey's to the keys directory
Expand Down Expand Up @@ -238,6 +239,11 @@ if [[ ${UPDATE_SERVER} == 1 ]]; then
if [[ -n $latestUpdate ]] && [[ $latestUpdate =~ ^[0-9]+$ ]]; then # Notify last update date, if valid
echo -e "\tMod was last updated: ${CYAN}$(date -d @${latestUpdate})${NC}"
fi

# Delete SteamCMD appworkshop cache before running to avoid mod download failures
echo -e "\tClearing SteamCMD appworkshop cache..."
rm -f ${WORKSHOP_DIR}/appworkshop_$GAME_ID.acf

echo -e "\tAttempting mod update/download via SteamCMD...\n"
RunSteamCMD 1 $modID
fi
Expand Down Expand Up @@ -280,6 +286,6 @@ echo -e "${CYAN}${modifiedStartup}${NC}\n"
${modifiedStartup}

if [ $? -ne 0 ]; then
echo -e "\n${RED}PTDL_CONTAINER_ERR: There was an error while attempting to run the start command.${NC}\n"
echo -e "\n${RED}[STARTUP_ERR]: There was an error while attempting to run the start command.${NC}\n"
exit 1
fi

0 comments on commit 2e3436f

Please sign in to comment.