55 lines
1.5 KiB
Bash
55 lines
1.5 KiB
Bash
#!/bin/bash
|
|
cd /home/container
|
|
|
|
# Set environment variable that holds the Internal Docker IP
|
|
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
|
|
export INTERNAL_IP
|
|
|
|
# DotNet environment setup
|
|
export DOTNET_ROOT=/usr/share/
|
|
export SUBNAUTICA_INSTALLATION_PATH=/mnt/server/Subnautica
|
|
|
|
# Fix X11 permissions
|
|
mkdir -p /tmp/.X11-unix
|
|
chmod 1777 /tmp/.X11-unix
|
|
|
|
# Start Xvfb for Wine (virtual display)
|
|
Xvfb :99 -screen 0 1024x768x16 -ac &
|
|
export DISPLAY=:99.0
|
|
sleep 3
|
|
|
|
# Wine configuration
|
|
export WINEARCH=win64
|
|
export WINEPREFIX=/home/container/.wine
|
|
export WINEDLLOVERRIDES="mscoree,mshtml="
|
|
|
|
# Check if Wine prefix exists, if not copy from template
|
|
if [ ! -d "$WINEPREFIX" ]; then
|
|
echo "Wine prefix not found, this should not happen in Docker..."
|
|
# Fallback: reinitialize if needed
|
|
echo "Reinitializing Wine prefix..."
|
|
timeout 60 wine wineboot --init || echo "Wine initialization timed out"
|
|
sleep 5
|
|
fi
|
|
|
|
# Test if Wine works
|
|
echo "Testing Wine..."
|
|
if timeout 10 wine cmd /c "echo Wine works"; then
|
|
echo "Wine test successful"
|
|
else
|
|
echo "Wine test failed, but continuing..."
|
|
fi
|
|
|
|
# Print versions
|
|
printf "\033[1m\033[33mcontainer@pelican~ \033[0mdotnet --version\n"
|
|
dotnet --version
|
|
|
|
printf "\033[1m\033[33mcontainer@pelican~ \033[0mwine --version\n"
|
|
wine --version
|
|
|
|
# Replace Startup Variables
|
|
MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
|
|
echo -e ":/home/container$ ${MODIFIED_STARTUP}"
|
|
|
|
# Run the Server
|
|
eval ${MODIFIED_STARTUP} |