Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions libs/qemu-docker/linux/src/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ cleanup() {
# Install trap for signals
trap cleanup SIGTERM SIGINT SIGHUP SIGQUIT

# Overlay mode: /golden mounted read-only, /storage starts empty
if [ -d "/golden" ] && [ -z "$(ls -A /storage 2>/dev/null)" ]; then
echo "Overlay mode detected, setting up copy-on-write..."
if cp -al /golden/. /storage/ 2>/dev/null; then
echo "Overlay setup complete (hard links)."
else
echo "Hard links not supported, falling back to full copy..."
cp -a /golden/. /storage/
echo "Overlay setup complete (full copy)."
fi
fi

# Start the VM in the background
echo "Starting Ubuntu VM..."
/usr/bin/tini -s /run/entry.sh &
Expand Down
12 changes: 12 additions & 0 deletions libs/qemu-docker/windows/src/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ cleanup() {
# Install trap for signals
trap cleanup SIGTERM SIGINT SIGHUP SIGQUIT

# Overlay mode: /golden mounted read-only, /storage starts empty
if [ -d "/golden" ] && [ -z "$(ls -A /storage 2>/dev/null)" ]; then
echo "Overlay mode detected, setting up copy-on-write..."
if cp -al /golden/. /storage/ 2>/dev/null; then
echo "Overlay setup complete (hard links)."
else
echo "Hard links not supported, falling back to full copy..."
cp -a /golden/. /storage/
echo "Overlay setup complete (full copy)."
fi
fi

# 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..."
Expand Down