Skip to content

Commit

Permalink
some more fixes for depotdownloader
Browse files Browse the repository at this point in the history
  • Loading branch information
gOOvER committed Dec 26, 2024
1 parent 8added6 commit d076fa0
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 33 deletions.
7 changes: 0 additions & 7 deletions depotdl/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
26 changes: 0 additions & 26 deletions depotdl/passwd.template

This file was deleted.

119 changes: 119 additions & 0 deletions depotdl/wine/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit d076fa0

Please sign in to comment.