-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
39 lines (28 loc) · 1005 Bytes
/
run.sh
File metadata and controls
39 lines (28 loc) · 1005 Bytes
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
#!/bin/bash
# Stop on any error
set -e
# --- BUILD KERNEL AND ISO ---
echo "Building kernel and creating ISO..."
bash build.sh
# --- CONFIGURATION ---
QEMU_VNC_PORT=5900
WEBSOCKET_PORT=6080
ISO_FILE=my-os.iso
# Find the path to the noVNC files dynamically and safely
NOVNC_ROOT=$(find /nix/store -maxdepth 1 -type d -name "*novnc*" | head -n1)/share/novnc/
# --- CLEANUP ---
echo "Stopping previous instances..."
# Use pkill for more robust process killing
pkill -f "qemu-system-x86_64" || true
pkill -f "websockify" || true
# --- LAUNCH QEMU ---
echo "Starting QEMU..."
# Boot from the ISO and run as a background daemon
qemu-system-x86_64 -cdrom "$ISO_FILE" -vnc :$QEMU_VNC_PORT -daemonize
# --- LAUNCH WEBSOCKET PROXY ---
echo "Starting websockify proxy..."
# & runs the command in the background
websockify --web="$NOVNC_ROOT" "$WEBSOCKET_PORT" localhost:"$QEMU_VNC_PORT" &
echo " "
echo "✅ QEMU and noVNC are running!"
echo " - The 'QEMU OS Preview' is available in the Previews tab."