add VNC support to run_archiso.sh
Usage: Launch run_archiso.sh -v ..., and then use a VNC viewer (e.g. from https://wiki.archlinux.org/index.php/List_of_applications/Internet#Remote_desktop) to connect (typically to `localhost`) on the default VNC port (5900). This enables using run_archiso in a "headless" session; e.g. when SSH logged in to the CLI of a VM, without a local display attached. This is handy e.g. when playing https://en.wikipedia.org/wiki/Inception and running an archlinux*.iso on any non-Arch (say Fedora workstation), on which one built a new ISO, that you then "run_archiso", inside which you could build another ISO, which you could itself start inside the nested VM... ;-) Jokes apart, this could also be used to run automated CI/CD tests of the built ISO, which is particularly interesting in combination with the cloud-init support; see https://wiki.archlinux.org/index.php/Cloud-init. see https://bugs.archlinux.org/task/69142
This commit is contained in:
parent
64091a1802
commit
e556491c27
@ -28,6 +28,7 @@ Options:
|
||||
-i [image] image to boot into
|
||||
-s use Secure Boot (only relevant when using UEFI)
|
||||
-u set boot type to 'UEFI'
|
||||
-v use VNC display (instead of default SDL)
|
||||
|
||||
Example:
|
||||
Run an image using UEFI:
|
||||
@ -87,12 +88,12 @@ run_image() {
|
||||
qemu-system-x86_64 \
|
||||
-boot order=d,menu=on,reboot-timeout=5000 \
|
||||
-m "size=3072,slots=0,maxmem=$((3072*1024*1024))" \
|
||||
-k en \
|
||||
-k en-us \
|
||||
-name archiso,process=archiso_0 \
|
||||
-device virtio-scsi-pci,id=scsi0 \
|
||||
-device "scsi-${mediatype%rom},bus=scsi0.0,drive=${mediatype}0" \
|
||||
-drive "id=${mediatype}0,if=none,format=raw,media=${mediatype/hd/disk},readonly=on,file=${image}" \
|
||||
-display sdl \
|
||||
-display "${display}" \
|
||||
-vga virtio \
|
||||
-audiodev pa,id=snd0 \
|
||||
-device ich9-intel-hda \
|
||||
@ -123,12 +124,13 @@ accessibility=''
|
||||
boot_type='bios'
|
||||
mediatype='cdrom'
|
||||
secure_boot='off'
|
||||
display='sdl'
|
||||
qemu_options=()
|
||||
working_dir="$(mktemp -dt run_archiso.XXXXXXXXXX)"
|
||||
trap cleanup_working_dir EXIT
|
||||
|
||||
if (( ${#@} > 0 )); then
|
||||
while getopts 'abdhi:su' flag; do
|
||||
while getopts 'abdhi:suv' flag; do
|
||||
case "$flag" in
|
||||
a)
|
||||
accessibility='on'
|
||||
@ -152,6 +154,10 @@ if (( ${#@} > 0 )); then
|
||||
s)
|
||||
secure_boot='on'
|
||||
;;
|
||||
v)
|
||||
display='none'
|
||||
qemu_options+=(-vnc 'vnc=0.0.0.0:0,vnc=[::]:0')
|
||||
;;
|
||||
*)
|
||||
printf '%s\n' "Error: Wrong option. Try 'run_archiso -h'."
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user