DEB_VERSION=$(dpkg-parsechangelog -S Version)

BUILD_BITS=$(dpkg-architecture --query DEB_BUILD_ARCH_BITS)

case "$arch-$BUILD_BITS" in
    i386-32) QEMU_CMD=(qemu-system-i386 -cpu kvm32 -machine pc -bios /usr/share/seabios/bios-256k.bin) ;;
    i386-64) QEMU_CMD=(qemu-system-amd64 -cpu kvm64 -machine pc -bios /usr/share/seabios/bios-256k.bin) ;;
    x86_64-64) QEMU_CMD=(qemu-system-amd64 -cpu kvm64 -machine pc -bios OVMF.fd) ;;
    arm64-64) QEMU_CMD=(qemu-system-arm64 -cpu max -machine virt -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd) ;;
    riscv64-64) QEMU_CMD=(qemu-system-riscv64 -cpu max -machine virt,pflash0=pflash0 -blockdev node-name=pflash0,driver=file,read-only=on,filename=/usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd) ;;
    loong64-64) QEMU_CMD=(qemu-system-loong64 -cpu max -machine virt -bios /usr/share/qemu-efi-loongarch64/QEMU_EFI.fd) ;;
    *) return 1 ;;
esac
QEMU_CMD+=(-smp cpus=1,cores=1,sockets=1 -m 1G)
QEMU_CMD+=(-chardev stdio,mux=on,id=char0)
QEMU_CMD+=(-nographic -monitor none -serial chardev:char0)
QEMU_CMD+=(-device virtio-rng-pci)
