fix(qemu): add setup detection and boot marker file creation

- Create windows.boot marker file if missing (fixes boot hang)
- Add /storage directory existence check before file creation
- Detect initial setup mode via /custom.iso presence
- Skip tail -f during setup to allow container exit
- Keep container alive only during normal runtime

Fixes issues:
- Container now exits properly after golden image creation
- Boot from golden image no longer hangs indefinitely
- Automatic distinction between setup and runtime modes
This commit is contained in:
synacktra.work@gmail.com
2025-11-10 00:30:01 +05:30
parent b92e1791d4
commit 2b0da424c9

View File

@@ -3,12 +3,17 @@
# Fix for Azure ML Job not using the correct root path
cd /
# Create windows.boot file if it doesn't exist (required for proper boot)
if [ -d "/storage" -a ! -f "/storage/windows.boot" ]; then
echo "Creating windows.boot file in /storage..."
touch /storage/windows.boot
fi
# Start the VM in the background
echo "Starting Windows VM..."
/usr/bin/tini -s /run/entry.sh &
echo "Live stream accessible at localhost:8006"
# Wait for the VM to start up and CUA computer-server to be ready
echo "Waiting for Windows to boot and CUA computer-server to start..."
while true; do
# Send a GET request to check if server is ready
@@ -33,6 +38,9 @@ socat TCP-LISTEN:5000,fork,reuseaddr TCP:20.20.20.21:5000 &
echo "Computer server accessible at localhost:5000"
# Keep container alive
echo "Container running. Press Ctrl+C to stop."
tail -f /dev/null
# Detect initial setup by presence of /custom.iso (setup ISO mount)
if [ ! -f "/custom.iso" ]; then
# Keep container alive
echo "Container running. Press Ctrl+C to stop."
tail -f /dev/null
fi