From d076fa00445f6ebe857ecb1ee7a4962ceb3be234 Mon Sep 17 00:00:00 2001 From: gOOvER <116325+gOOvER@users.noreply.github.com> Date: Thu, 26 Dec 2024 08:36:20 +0100 Subject: [PATCH] some more fixes for depotdownloader --- depotdl/debian/Dockerfile | 7 -- depotdl/{ => debian}/entrypoint.sh | 0 depotdl/passwd.template | 26 ------- depotdl/wine/entrypoint.sh | 119 +++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+), 33 deletions(-) rename depotdl/{ => debian}/entrypoint.sh (100%) delete mode 100644 depotdl/passwd.template create mode 100644 depotdl/wine/entrypoint.sh diff --git a/depotdl/debian/Dockerfile b/depotdl/debian/Dockerfile index 8c82d078..0d1ab15b 100644 --- a/depotdl/debian/Dockerfile +++ b/depotdl/debian/Dockerfile @@ -117,13 +117,6 @@ ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 -## Prepare NSS Wrapper for the entrypoint as a workaround for Valheim 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} \ - && chmod g+rw ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP} -ADD passwd.template /passwd.template - ## Setup user and working directory RUN useradd -m -d /home/container -s /bin/bash container USER container diff --git a/depotdl/entrypoint.sh b/depotdl/debian/entrypoint.sh similarity index 100% rename from depotdl/entrypoint.sh rename to depotdl/debian/entrypoint.sh diff --git a/depotdl/passwd.template b/depotdl/passwd.template deleted file mode 100644 index d14bace5..00000000 --- a/depotdl/passwd.template +++ /dev/null @@ -1,26 +0,0 @@ -root:x:0:0:root:/root:/bin/bash -daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin -bin:x:2:2:bin:/bin:/usr/sbin/nologin -sys:x:3:3:sys:/dev:/usr/sbin/nologin -sync:x:4:65534:sync:/bin:/bin/sync -games:x:5:60:games:/usr/games:/usr/sbin/nologin -man:x:6:12:man:/var/cache/man:/usr/sbin/nologin -lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin -mail:x:8:8:mail:/var/mail:/usr/sbin/nologin -news:x:9:9:news:/var/spool/news:/usr/sbin/nologin -uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin -proxy:x:13:13:proxy:/bin:/usr/sbin/nologin -www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin -backup:x:34:34:backup:/var/backups:/usr/sbin/nologin -list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin -irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin -gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin -nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin -systemd-timesync:x:100:102:systemd Time Synchronization,,,:/run/systemd:/bin/false -systemd-network:x:101:103:systemd Network Management,,,:/run/systemd/netif:/bin/false -systemd-resolve:x:102:104:systemd Resolver,,,:/run/systemd/resolve:/bin/false -systemd-bus-proxy:x:103:105:systemd Bus Proxy,,,:/run/systemd:/bin/false -syslog:x:104:108::/home/syslog:/bin/false -messagebus:x:106:109::/var/run/dbus:/bin/false -bind:x:108:112::/var/cache/bind:/bin/false -${USER_NAME}:x:${USER_ID}:${GROUP_ID}:${USER_NAME}:${HOME}:/bin/bash diff --git a/depotdl/wine/entrypoint.sh b/depotdl/wine/entrypoint.sh new file mode 100644 index 00000000..2e16f97d --- /dev/null +++ b/depotdl/wine/entrypoint.sh @@ -0,0 +1,119 @@ +#!/bin/bash + +clear +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + + +# Wait for the container to fully initialize +sleep 1 + +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Default the IMAGE_PROMPT environment variable to something nice +IMAGE_PROMPT=${IMAGE_PROMPT:-$'\033[1m\033[33mcontainer@pterodactyl~ \033[0m'} +export IMAGE_PROMPT + +# Information output +echo -e "${BLUE}---------------------------------------------------------------------${NC}" +echo -e "${YELLOW}Wine Image from gOOvER${NC}" +echo -e "${BLUE}---------------------------------------------------------------------${NC}" +echo -e "${YELLOW}Running on Debian $(cat /etc/debian_version)${NC}" +echo -e "${YELLOW}Current timezone: $(cat /etc/timezone)${NC}" +echo -e "${YELLOW}Wine Version:${NC} ${RED} $(wine --version)${NC}" +echo -e "${BLUE}---------------------------------------------------------------------${NC}" + +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP + +# Switch to the container's working directory +cd /home/container || exit 1 + +## just in case someone removed the defaults. +if [ "${STEAM_USER}" == "" ]; then + echo -e "${BLUE}---------------------------------------------------------------------${NC}" + echo -e "${YELLOW}Steam user is not set.\n ${NC}" + echo -e "${YELLOW}Using anonymous user.\n ${NC}" + echo -e "${BLUE}---------------------------------------------------------------------${NC}" + STEAM_USER=anonymous + STEAM_PASS="" + STEAM_AUTH="" +else + echo -e "${BLUE}---------------------------------------------------------------------${NC}" + echo -e "${YELLOW}user set to ${STEAM_USER} ${NC}" + echo -e "${BLUE}---------------------------------------------------------------------${NC}" +fi + +## if auto_update is not set or to 1 update +if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then + DepotDownloader -dir /home/container -app 1007 + DepotDownloader -dir /home/container $( [[ -z ${STEAM_USER} ]] || printf %s "-username ${STEAM_USER} -password ${STEAM_PASS} -remember-password" ) $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '-os windows' ) -app ${STEAM_APPID} $( [[ -z ${STEAM_BETAID} ]] || printf %s "-beta ${STEAM_BETAID}" ) $( [[ -z ${STEAM_BETAPASS} ]] || printf %s "-betapassword ${STEAM_BETAPASS}" ) $( [[ "${STEAM_VALIDATE}" == "1" ]] && printf %s '-validate' ) +else + echo -e "${BLUE}---------------------------------------------------------------${NC}" + echo -e "${YELLOW}Not updating game server as auto update was set to 0. Starting Server${NC}" + echo -e "${BLUE}---------------------------------------------------------------${NC}" +fi + +if [[ $XVFB == 1 ]]; then + Xvfb :0 -screen 0 ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}x${DISPLAY_DEPTH} & +fi + +# Install necessary to run packages +echo -e "${BLUE}---------------------------------------------------------------------${NC}" +echo -e "${RED}First launch will throw some errors. Ignore them${NC}" +echo -e "${BLUE}---------------------------------------------------------------------${NC}" +mkdir -p $WINEPREFIX + +# Check if wine-gecko required and install it if so +if [[ $WINETRICKS_RUN =~ gecko ]]; then + echo -e "${BLUE}---------------------------------------------------------------------${NC}" + echo -e "${YELLOW}Installing Wine Gecko${NC}" + echo -e "${BLUE}---------------------------------------------------------------------${NC}" + WINETRICKS_RUN=${WINETRICKS_RUN/gecko} + + if [ ! -f "$WINEPREFIX/gecko_x86.msi" ]; then + wget -q -O $WINEPREFIX/gecko_x86.msi http://dl.winehq.org/wine/wine-gecko/2.47.4/wine_gecko-2.47.4-x86.msi + fi + + if [ ! -f "$WINEPREFIX/gecko_x86_64.msi" ]; then + wget -q -O $WINEPREFIX/gecko_x86_64.msi http://dl.winehq.org/wine/wine-gecko/2.47.4/wine_gecko-2.47.4-x86_64.msi + fi + + wine msiexec /i $WINEPREFIX/gecko_x86.msi /qn /quiet /norestart /log $WINEPREFIX/gecko_x86_install.log + wine msiexec /i $WINEPREFIX/gecko_x86_64.msi /qn /quiet /norestart /log $WINEPREFIX/gecko_x86_64_install.log +fi + +# Check if wine-mono required and install it if so +if [[ $WINETRICKS_RUN =~ mono ]]; then + echo -e "${BLUE}---------------------------------------------------------------------${NC}" + echo -e "${YELLOW}Installing Wine Mono${NC}" + echo -e "${BLUE}---------------------------------------------------------------------${NC}" + WINETRICKS_RUN=${WINETRICKS_RUN/mono} + + if [ ! -f "$WINEPREFIX/mono.msi" ]; then + wget -q -O $WINEPREFIX/mono.msi https://dl.winehq.org/wine/wine-mono/9.3.0/wine-mono-9.3.0-x86.msi + fi + + wine msiexec /i $WINEPREFIX/mono.msi /qn /quiet /norestart /log $WINEPREFIX/mono_install.log +fi + +# List and install other packages +for trick in $WINETRICKS_RUN; do + echo -e "${BLUE}---------------------------------------------------------------------${NC}" + echo -e "${YELLOW}Installing: ${NC} ${GREEN} $trick ${NC}" + echo -e "${BLUE}---------------------------------------------------------------------${NC}" + winetricks -q $trick +done + +# Replace Startup Variables +MODIFIED_STARTUP=$(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') +echo ":/home/container$ ${MODIFIED_STARTUP}" + +# Run the Server +eval ${MODIFIED_STARTUP}