Shinhati2023 commited on
Commit
12cdf9f
·
verified ·
1 Parent(s): 247f724

Create start.sh

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