QEmu configs

~$ cd /etc/service/qemu-vm
qemu-vm$ cat run
#!/bin/execlineb -PW
fdmove -c -- 2 1
backtick -in NAME { pipeline { pwd } xargs basename }
importas -iu NAME NAME
redirfd -w -- 1 "../${NAME}-log/fifo"
fdmove -c -- 2 1

fdreserve 5
multisubstitute
{
  importas -iu -- CDFD FD0
  importas -iu -- HDFD FD1
  importas -iu -- CONFD FD2
  importas -iu -- MONFD FD3
  importas -iu -- TAP0FD FD4
}

redirfd -r -- "$CDFD" data/cd.iso
redirfd -u -- "$HDFD" data/hd.qcow2
/usr/local/bin/named-piperw console 0 "$CONFD"
fdmove -c "$MONFD" 0
s6-ipcserver-socketbinder -- mon fdswap "$MONFD" 0

s6-envuidgid qemu
unexport GIDLIST
s6-envdir env

ip netns exec lan
/usr/local/sbin/open-tap -d "$TAP0FD" -e TAP0IFNAME --
unshare --net --

multisubstitute
{
  importas -iu -- TAP0IFNAME TAP0IFNAME
  importas -iu -- MACHINE_UUID MACHINE_UUID
  importas -iu -- UID UID
  importas -iu -- GID GID
}

if
{
  redirfd -r -- 0 /dev/null
  fdmove -c -- 1 2
  fdclose "$CDFD"
  fdclose "$HDFD"
  fdclose "$CONFD"
  fdclose "$MONFD"
  fdclose "$TAP0FD"
  if
  {
    fdclose 3
    if { ip link set lo up }
    ip netns exec lan
    if { ip link set "$TAP0IFNAME" master br60 }
    ip link set "$TAP0IFNAME" up
  }
  fdmove 1 3
  echo ready.
}
fdclose 3

qemu-system-x86_64
-nodefaults
-no-user-config
-nographic

-name Alpine
-uuid "$MACHINE_UUID"

-runas "${UID}:${GID}"
-run-with chroot=/var/empty
-action panic=shutdown
-action reboot=shutdown
-action watchdog=shutdown

-machine q35
-smp sockets=1,cpus=2,cores=2
-cpu host
-accel kvm
-m 1024M
-k en-us

-device qxl
-vga qxl
-spice ipv4=off,ipv6=off,unix=on,addr=spice,disable-ticketing=on
-audiodev spice,id=audio0
-vnc unix:vnc,lossy=on,share=force-shared,audiodev=audio0,power-control=off

-device virtio-net,netdev=tap0
-netdev "tap,id=tap0,fd=${TAP0FD}"

-chardev stdio,id=console,mux=off,signal=off
-device isa-serial,index=0,chardev=console

-chardev "socket,id=mon,fd=${MONFD},server=on,wait=off"
-mon chardev=mon

-device qemu-xhci,id=xhci0
-device usb-kbd,bus=xhci0.0
-device usb-tablet,bus=xhci0.0

-device virtio-balloon

-add-fd "fd=${CDFD},set=0,opaque=cdrom0"
-blockdev driver=raw,node-name=cdrom0,read-only=on,file.driver=file,file.filename=/dev/fdset/0
-device virtio-scsi-pci,id=scsi0
-device scsi-cd,bus=scsi0.0,drive=cdrom0

-add-fd "fd=${HDFD},set=1,opaque=hd0"
-blockdev driver=qcow2,node-name=hd0,file.driver=file,file.filename=/dev/fdset/1
-device virtio-blk-pci,drive=hd0

-boot order=dc
qemu-vm$ _

<- others on the web zone ->

HOSTED BY CLONQ!