Refactor entrypoint script: enhance X11 permissions handling, streamline Wine initialization, and improve error handling for Wine test
This commit is contained in:
@@ -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
|
# 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/
|
export DOTNET_ROOT=/usr/share/
|
||||||
|
|
||||||
# Fix X11 permissions
|
# Fix X11 permissions (run as root first)
|
||||||
mkdir -p /tmp/.X11-unix
|
sudo mkdir -p /tmp/.X11-unix
|
||||||
chmod 1777 /tmp/.X11-unix
|
sudo chmod 1777 /tmp/.X11-unix
|
||||||
|
sudo chown root:root /tmp/.X11-unix
|
||||||
|
|
||||||
# Start Xvfb for Wine (virtual display)
|
# Start Xvfb for Wine (virtual display)
|
||||||
Xvfb :99 -screen 0 1024x768x16 &
|
Xvfb :99 -screen 0 1024x768x16 -ac &
|
||||||
export DISPLAY=:99.0
|
export DISPLAY=:99.0
|
||||||
|
|
||||||
# Wait for Xvfb to start
|
# Wait for Xvfb to start
|
||||||
@@ -26,30 +27,29 @@ rm -rf "$WINEPREFIX"
|
|||||||
# Set Wine architecture to 64-bit
|
# Set Wine architecture to 64-bit
|
||||||
export WINEARCH=win64
|
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..."
|
echo "Creating new Wine prefix..."
|
||||||
wineboot --init
|
wineboot --init 2>/dev/null &
|
||||||
|
|
||||||
# Wait for wineboot to complete
|
# Wait for wineboot process to complete
|
||||||
sleep 10
|
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..."
|
echo "Testing Wine installation..."
|
||||||
if ! wine cmd /c "echo Wine test successful"; then
|
timeout 30 wine cmd /c "echo Wine test successful" 2>/dev/null
|
||||||
echo "Wine initialization failed, trying again..."
|
if [ $? -eq 0 ]; then
|
||||||
rm -rf "$WINEPREFIX"
|
echo "Wine initialization complete and verified."
|
||||||
wineboot --init
|
else
|
||||||
sleep 15
|
echo "Wine test failed, but continuing anyway..."
|
||||||
|
|
||||||
# Try again
|
|
||||||
if ! wine cmd /c "echo Wine test successful"; then
|
|
||||||
echo "Wine installation appears to be broken"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Wine initialization complete and verified."
|
|
||||||
|
|
||||||
# print the dotnet version on startup
|
# print the dotnet version on startup
|
||||||
printf "\033[1m\033[33mcontainer@pelican~ \033[0mdotnet --version\n"
|
printf "\033[1m\033[33mcontainer@pelican~ \033[0mdotnet --version\n"
|
||||||
dotnet --version
|
dotnet --version
|
||||||
|
Reference in New Issue
Block a user