{
    "variables": {
        "accelerator": "kvm",
        "img_name": "alpine-virt-3.18.4"
    },
    "builders": [
        {
            "communicator": "none",
            "type": "qemu",
            "accelerator": "{{ user `accelerator` }}",
            "use_default_display": true,
            "iso_url": "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-virt-3.18.4-x86_64.iso",
            "iso_checksum": "24d79bc148c05a864c2914dfa41a6ffbf808973e44de88c7700d30b4517965b2",
            "http_directory": "./files",
            "vm_name": "{{ user `img_name` }}.img",
            "disk_size": "200M",
            "format": "raw",
            "qemu_img_args": {
                "create": ["-o", "preallocation=off"]
            },
            "disk_interface": "virtio",
            "disk_discard": "unmap",
            "boot_wait": "15s",
            "boot_key_interval": "20ms",
            "boot_keygroup_interval": "100ms",
            "boot_command": [
                "root<enter>",
                "ifconfig lo up<enter>",
                "ifconfig eth0 up && udhcpc -i eth0<enter><wait5>",
                "wget -q http://{{ .HTTPIP }}:{{ .HTTPPort }}/alpine.conf && setup-alpine -e -f alpine.conf<enter><wait><enter><wait500ms><enter><wait5><enter><wait500ms><enter><wait500ms>",
                "wget -q http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh && chmod +x install.sh && ./install.sh<enter><wait30s>",
                "poweroff<enter>"
            ]
        }
    ],
    "post-processors": [
        {
            "type": "shell-local",
            "inline": [
                "qemu-img convert -c -O qcow2 output-qemu/{{ user `img_name` }}.img output-qemu/{{ user `img_name` }}.qcow2",
                "rm output-qemu/{{ user `img_name` }}.img"
            ]
        }
    ]
}
