66 lines
1.7 KiB
Bash
66 lines
1.7 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
|
|
|
|
# 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
|
|
|
|
# Start Xvfb for Wine (virtual display)
|
|
Xvfb :99 -screen 0 1024x768x16 -ac &
|
|
export DISPLAY=:99.0
|
|
|
|
# Wait for Xvfb to start
|
|
sleep 3
|
|
|
|
# Force reinitialize Wine prefix to ensure it's properly set up
|
|
echo "Reinitializing Wine prefix to ensure proper setup..."
|
|
rm -rf "$WINEPREFIX"
|
|
|
|
# Set Wine architecture to 64-bit
|
|
export WINEARCH=win64
|
|
|
|
# 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 2>/dev/null &
|
|
|
|
# Wait for wineboot process to complete
|
|
sleep 15
|
|
|
|
# Kill any remaining Wine processes
|
|
pkill -f wine
|
|
|
|
# Try a simple Wine command to verify it works
|
|
echo "Testing Wine installation..."
|
|
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
|
|
|
|
# print the dotnet version on startup
|
|
printf "\033[1m\033[33mcontainer@pelican~ \033[0mdotnet --version\n"
|
|
dotnet --version
|
|
|
|
# print the wine version on startup
|
|
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}
|