diff --git a/satisfactory/Dockerfile b/satisfactory/Dockerfile index 9441b69..24204f9 100644 --- a/satisfactory/Dockerfile +++ b/satisfactory/Dockerfile @@ -20,7 +20,7 @@ # SOFTWARE. # -FROM --platform=$BUILDPLATFORM debian:stable-slim +FROM debian:stable-slim LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" @@ -42,7 +42,7 @@ RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key \ && wget -nc https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10/amd64/libfaudio0_20.01-0~buster_amd64.deb \ && wget -nc https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10/i386/libfaudio0_20.01-0~buster_i386.deb \ && apt install -y ./libfaudio0_20.01-0~buster_* \ - && apt install -y --install-recommends winehq-stable cabextract xvfb + && apt install -y --install-recommends winehq-stable cabextract USER container ENV USER=container HOME=/home/container diff --git a/satisfactory/entrypoint.sh b/satisfactory/entrypoint.sh index 3264527..0c77e1d 100644 --- a/satisfactory/entrypoint.sh +++ b/satisfactory/entrypoint.sh @@ -22,20 +22,47 @@ # SOFTWARE. # -# Default the TZ environment variable to UTC. +# Default the TZ environment variable to UTC TZ=${TZ:-UTC} export TZ +# Set the GAMECONFIGDIR environment variable +GAMECONFIGDIR="/home/container/.wine/drive_c/users/container/Local Settings/Application Data/FactoryGame/Saved" +export GAMECONFIGDIR + # Switch to the container's working directory cd /home/container -# Set environment variable that holds the Internal Docker IP -export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` +# Create required directories +mkdir -p /home/container/config /home/container/gamefiles /home/container/saves "$GAMECONFIGDIR/Config/WindowsNoEditor" "$GAMECONFIGDIR/Logs" "$GAMECONFIGDIR/SaveGames/common" -# Replace variables in the startup command -MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +# Touch the log file +touch "$GAMECONFIGDIR/Logs/FactoryGame.log" + +# Copy config files +cp /home/container/config/{Engine.ini,Game.ini,Scalability.ini} "$GAMECONFIGDIR/Config/WindowsNoEditor/" + +# Copy save files +cp -rp /home/container/saves/*.sav "$GAMECONFIGDIR/SaveGames/common/" + +# Get the latest save file +LATEST_SAVE_FILE=$(ls -Art "$GAMECONFIGDIR/SaveGames/common" | tail -n 1) + +# Move latest save file +if [[ ! "$LATEST_SAVE_FILE" == "savefile.sav" ]]; then + printf "\\nMoving most recent save (%s) to savefile.sav\\n" "$LATEST_SAVE_FILE" + mv "$GAMECONFIGDIR/SaveGames/common/$LATEST_SAVE_FILE" "$GAMECONFIGDIR/SaveGames/common/savefile.sav" +fi + +# Switch to the gamefiles directory +cd /home/container/gamefiles + +# Start Satisfactory (runs in the background) printf '\033[1m\033[33mcontainer@pterodactyl~ \033[0m' -echo "${MODIFIED_STARTUP}" +echo "wine start FactoryGame.exe -nosteamclient -nullrhi -nosplash -nosound" +wine start FactoryGame.exe -nosteamclient -nullrhi -nosplash -nosound -# Run the startup command -exec env ${MODIFIED_STARTUP} +# Tail the satisfactory log file +printf '\033[1m\033[33mcontainer@pterodactyl~ \033[0m' +echo "tail -f \"$GAMECONFIGDIR/Logs/FactoryGame.log\"" +tail -f "$GAMECONFIGDIR/Logs/FactoryGame.log"