Spaces:
Paused
Paused
File size: 2,030 Bytes
12cdf9f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
#!/bin/bash
# --- 1. SET UP STORAGE PATHS ---
# We work in /tmp or current dir to ensure we have write access
cd /app
# --- 2. DOWNLOAD ANDROID ISO (443 MB) ---
ISO_FILE="android-x86-4.4-r5.iso"
ISO_URL="https://sourceforge.net/projects/android-x86/files/Release%204.4/android-x86-4.4-r5.iso/download"
if [ ! -f "$ISO_FILE" ]; then
echo "Disk space is tight. Downloading Android KitKat..."
# -q for quiet (saves log space), --show-progress for visual
wget -q --show-progress -O "$ISO_FILE" "$ISO_URL"
else
echo "Android ISO found. Skipping download."
fi
# --- 3. DOWNLOAD & SETUP NOVNC (Web Viewer) ---
# We download the UI directly from GitHub to save space compared to installing a package
if [ ! -d "noVNC-1.4.0" ]; then
echo "Downloading noVNC Interface..."
wget -q -O novnc.zip https://github.com/novnc/noVNC/archive/refs/tags/v1.4.0.zip
unzip -q novnc.zip
rm novnc.zip # Delete zip to save space immediately
# Download Websockify (The bridge between QEMU and Browser)
echo "Downloading Websockify..."
wget -q -O websockify.zip https://github.com/novnc/websockify/archive/refs/tags/v0.11.0.zip
unzip -q websockify.zip
rm websockify.zip
# Link websockify into noVNC
mv websockify-0.11.0 noVNC-1.4.0/utils/websockify
fi
# --- 4. START THE SYSTEM ---
echo "Starting Web Server on port 7860..."
# Start the noVNC web server in the background
./noVNC-1.4.0/utils/novnc_proxy --vnc localhost:5900 --listen 7860 &
echo "Booting Android (Touch Mode Enabled)..."
# FLAGS EXPLAINED FOR 1GB LIMIT & MOBILE:
# -m 1024: Reduced RAM to 1GB (Leaving 1GB for ISO storage on disk)
# -device usb-tablet: Absolute touch input for mobile users
# -vga std: Standard graphics
# -snapshot: Write temporary data to RAM, not Disk (Saves storage!)
qemu-system-i386 \
-m 1024 \
-smp 2 \
-cpu qemu64 \
-vga std \
-net nic,model=virtio -net user \
-cdrom "$ISO_FILE" \
-device usb-tablet \
-vnc :0 \
-snapshot
|