[DayZ] Image Cleanup (#247)

* [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
This commit is contained in:
Red-Thirten
2024-06-06 03:35:04 -07:00
committed by GitHub
parent 5f7b002633
commit 2e3436f381
2 changed files with 21 additions and 15 deletions

View File

@@ -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
@@ -17,7 +17,6 @@ RUN dpkg --add-architecture i386 \
iproute2 \
gettext-base \
ca-certificates \
numactl \
libssl-dev \
lib32gcc-s1 \
libsdl2-2.0-0 \
@@ -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} \
@@ -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"]

View File

@@ -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'
@@ -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
@@ -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
@@ -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
@@ -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