Refactor entrypoint script: enhance Wine initialization process and remove obsolete test script
This commit is contained in:
@@ -39,8 +39,6 @@ WORKDIR /home/container
|
|||||||
STOPSIGNAL SIGINT
|
STOPSIGNAL SIGINT
|
||||||
|
|
||||||
COPY --chown=container:container ./../entrypoint.sh /entrypoint.sh
|
COPY --chown=container:container ./../entrypoint.sh /entrypoint.sh
|
||||||
COPY --chown=container:container ./../test-wine-dotnet.sh /test-wine-dotnet.sh
|
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
RUN chmod +x /test-wine-dotnet.sh
|
|
||||||
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
|
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
|
||||||
CMD ["/entrypoint.sh"]
|
CMD ["/entrypoint.sh"]
|
@@ -8,37 +8,48 @@ 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
|
||||||
|
mkdir -p /tmp/.X11-unix
|
||||||
|
chmod 1777 /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 &
|
||||||
export DISPLAY=:99.0
|
export DISPLAY=:99.0
|
||||||
|
|
||||||
# Wait for Xvfb to start
|
# Wait for Xvfb to start
|
||||||
sleep 2
|
sleep 3
|
||||||
|
|
||||||
# Initialize Wine prefix if it doesn't exist
|
# Force reinitialize Wine prefix to ensure it's properly set up
|
||||||
if [ ! -d "$WINEPREFIX" ]; then
|
echo "Reinitializing Wine prefix to ensure proper setup..."
|
||||||
echo "Initializing Wine prefix..."
|
rm -rf "$WINEPREFIX"
|
||||||
|
|
||||||
|
# Set Wine architecture to 64-bit
|
||||||
|
export WINEARCH=win64
|
||||||
|
|
||||||
|
# Initialize Wine prefix
|
||||||
|
echo "Creating new Wine prefix..."
|
||||||
|
wineboot --init
|
||||||
|
|
||||||
|
# Wait for wineboot to complete
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
# Test if Wine can load basic Windows DLLs
|
||||||
|
echo "Testing Wine installation..."
|
||||||
|
if ! wine cmd /c "echo Wine test successful"; then
|
||||||
|
echo "Wine initialization failed, trying again..."
|
||||||
|
rm -rf "$WINEPREFIX"
|
||||||
wineboot --init
|
wineboot --init
|
||||||
|
sleep 15
|
||||||
|
|
||||||
# Wait for wineboot to complete
|
# Try again
|
||||||
sleep 5
|
if ! wine cmd /c "echo Wine test successful"; then
|
||||||
|
echo "Wine installation appears to be broken"
|
||||||
# Install essential Windows components
|
exit 1
|
||||||
winetricks -q corefonts vcrun2019 dotnet48
|
|
||||||
|
|
||||||
echo "Wine initialization complete."
|
|
||||||
else
|
|
||||||
echo "Wine prefix already exists, checking if it's working..."
|
|
||||||
# Test if Wine is working properly
|
|
||||||
if ! wine --version > /dev/null 2>&1; then
|
|
||||||
echo "Wine prefix seems corrupted, reinitializing..."
|
|
||||||
rm -rf "$WINEPREFIX"
|
|
||||||
wineboot --init
|
|
||||||
sleep 5
|
|
||||||
winetricks -q corefonts vcrun2019 dotnet48
|
|
||||||
fi
|
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
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "Testing Wine + .NET integration..."
|
|
||||||
|
|
||||||
# Test 1: Check if .NET works natively
|
|
||||||
echo "1. Testing native .NET:"
|
|
||||||
dotnet --version
|
|
||||||
|
|
||||||
# Test 2: Check if Wine works
|
|
||||||
echo "2. Testing Wine:"
|
|
||||||
wine --version
|
|
||||||
|
|
||||||
# Test 3: Test Wine with .NET (this will use .NET through Wine)
|
|
||||||
echo "3. Testing .NET through Wine:"
|
|
||||||
wine dotnet --version
|
|
||||||
|
|
||||||
# Test 4: Create a simple .NET console app and run it through Wine
|
|
||||||
echo "4. Creating and running a simple .NET app through Wine:"
|
|
||||||
dotnet new console -n TestApp -o /tmp/testapp
|
|
||||||
cd /tmp/testapp
|
|
||||||
dotnet build
|
|
||||||
wine dotnet /tmp/testapp/bin/Debug/net9.0/TestApp.dll
|
|
||||||
|
|
||||||
echo "Wine + .NET integration test completed!"
|
|
Reference in New Issue
Block a user