-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun
executable file
·73 lines (63 loc) · 1.44 KB
/
run
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
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
gflag=
sflag=
while getopts gs opt; do
case $opt in
g) gflag=1 ;;
s) sflag=1 ;;
*)
printf "usage: %s [-gs]\n" "$0" >&2
exit 1
;;
esac
done
shift $(($OPTIND - 1))
if [ -z "$gflag" ] && [ -z "$sflag" ]; then
gflag=1
fi
cat <<'EOF'
Booting oasis qemu image...
Tips:
- To access the qemu monitor, use Ctrl-a c.
- The root password is empty.
- A regular user 'oasis' is available, also with empty password.
- To run commands as root, use doas(1)
- Text editors available are vis(1) and ed(1)
- To launch velox, run `swc-launch velox`.
* To launch st from velox, use Alt-Shift-Enter
* To launch netsurf from velox, use Alt-b
* To launch dmenu from velox, use Alt-r
- To shutdown, run `kill -s USR1 1`.
See README.md for more information.
EOF
append="init=/bin/sinit root=/dev/vda ro TERM=$TERM"
stdio='stdio,id=stdio'
if [ -n "$sflag" ]; then
append="$append console=hvc0"
stdio="$stdio,mux=on,signal=off"
set -- \
-device virtio-serial \
-device virtconsole,chardev=stdio \
"$@"
fi
if [ -n "$gflag" ]; then
append="$append console=tty0"
set -- \
-device virtio-keyboard \
-device virtio-tablet \
-device virtio-vga \
"$@"
else
set -- -display none "$@"
fi
exec qemu-system-x86_64 \
-enable-kvm -cpu host -m 2048 \
-kernel bzImage \
-append "$append" \
-device virtio-balloon \
-device virtio-rng \
-drive file=root.qcow2,media=disk,if=virtio \
-nic user,model=virtio \
-chardev "$stdio" \
-mon chardev=stdio \
"$@"