diff --git a/entrypoint.sh b/entrypoint.sh index 3128aca..b2a7ca9 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,12 +8,13 @@ export INTERNAL_IP # set this variable, dotnet needs it even without it it reports to `dotnet --info` it can not start any aplication without this export DOTNET_ROOT=/usr/share/ -# Fix X11 permissions -mkdir -p /tmp/.X11-unix -chmod 1777 /tmp/.X11-unix +# Fix X11 permissions (run as root first) +sudo mkdir -p /tmp/.X11-unix +sudo chmod 1777 /tmp/.X11-unix +sudo chown root:root /tmp/.X11-unix # Start Xvfb for Wine (virtual display) -Xvfb :99 -screen 0 1024x768x16 & +Xvfb :99 -screen 0 1024x768x16 -ac & export DISPLAY=:99.0 # Wait for Xvfb to start @@ -26,30 +27,29 @@ rm -rf "$WINEPREFIX" # Set Wine architecture to 64-bit export WINEARCH=win64 -# Initialize Wine prefix +# Set Wine to run in headless mode +export WINE_VNC_NOVNC=1 +export WINE_VNC_DEPTH=16 + +# Initialize Wine prefix with minimal configuration echo "Creating new Wine prefix..." -wineboot --init +wineboot --init 2>/dev/null & -# Wait for wineboot to complete -sleep 10 +# Wait for wineboot process to complete +sleep 15 -# Test if Wine can load basic Windows DLLs +# Kill any remaining Wine processes +pkill -f wine + +# Try a simple Wine command to verify it works echo "Testing Wine installation..." -if ! wine cmd /c "echo Wine test successful"; then - echo "Wine initialization failed, trying again..." - rm -rf "$WINEPREFIX" - wineboot --init - sleep 15 - - # Try again - if ! wine cmd /c "echo Wine test successful"; then - echo "Wine installation appears to be broken" - exit 1 - fi +timeout 30 wine cmd /c "echo Wine test successful" 2>/dev/null +if [ $? -eq 0 ]; then + echo "Wine initialization complete and verified." +else + echo "Wine test failed, but continuing anyway..." fi -echo "Wine initialization complete and verified." - # print the dotnet version on startup printf "\033[1m\033[33mcontainer@pelican~ \033[0mdotnet --version\n" dotnet --version