Shinhati2023 commited on
Commit
b152820
·
verified ·
1 Parent(s): f3f703c

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +42 -23
start.sh CHANGED
@@ -1,40 +1,59 @@
1
  #!/bin/bash
2
 
3
- # --- CONFIGURATION ---
 
 
 
 
4
  ISO_FILE="android-x86-4.4-r5.iso"
5
- # Direct SourceForge link for Android 4.4.4 r5 (KitKat)
6
- DOWNLOAD_URL="https://sourceforge.net/projects/android-x86/files/Release%204.4/android-x86-4.4-r5.iso/download"
7
- # ---------------------
8
 
9
- echo "--- Checking for Android Image ---"
10
  if [ ! -f "$ISO_FILE" ]; then
11
- echo "Downloading Android 4.4.4 KitKat (x86)..."
12
- # wget -c allows resuming broken downloads
13
- wget -c -O "$ISO_FILE" "$DOWNLOAD_URL"
14
  else
15
- echo "ISO already exists. Skipping download."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  fi
17
 
18
- echo "--- Starting Network Bridge ---"
19
- # We start websockify on port 7860.
20
- # We point the web-root to /usr/share/novnc so the browser loads the UI.
21
- # The target is localhost:5900 (where QEMU sends video).
22
- websockify --web=/usr/share/novnc/ 7860 localhost:5900 &
23
 
24
- echo "--- Booting Android Emulator ---"
25
- # EXPLANATION OF FLAGS FOR MOBILE USERS:
26
- # -device usb-tablet: CRITICAL. Maps mouse clicks to absolute screen coordinates.
27
- # Without this, touch controls will fail.
28
- # -vga std: Standard graphics, best compatibility with browser viewing.
29
- # -smp 2: Use 2 CPU cores for smoother UI threads.
30
- # -m 2048: 2GB RAM.
31
 
32
  qemu-system-i386 \
33
- -m 2048 \
34
  -smp 2 \
35
  -cpu qemu64 \
36
  -vga std \
37
  -net nic,model=virtio -net user \
38
  -cdrom "$ISO_FILE" \
39
  -device usb-tablet \
40
- -vnc :0
 
 
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