define OPACK_PACKER_CONTENT = { "description": "OpenBSD $(OPACK_SYS_VERSION) $(OPACK_SYS_ARCHITECTURE)", "variables": { "box_tag": "$(OPACK_SYS_HOSTNAME)-$(OPACK_TARGET)-{{ timestamp }}", "disk_size": "$(OPACK_SYS_DISK_SIZE)", "memory": "$(OPACK_SYS_MEMORY)", "cpus": "$(OPACK_SYS_CPU)", "version": "$(OPACK_BOX_VERSION)" }, "builders": [ { "type": "qemu", "vm_name": "$(OPACK_SYS_HOSTNAME)-$(OPACK_TARGET)", "cpus": "{{user `cpus`}}", "memory": "{{user `memory`}}", "headless": $(OPACK_SYS_HEADLESS), "boot_key_interval": "10ms", "disk_size": "{{user `disk_size`}}", "disk_interface": "virtio", "disk_compression": true, "http_directory": "./http", "iso_urls": "$(OPACK_SYS_ISO_URL)", "iso_checksum": "sha256:$(OPACK_SYS_ISO_SHA256SUM)", "net_device": "virtio-net", "communicator": "ssh", "ssh_username": "root", "ssh_private_key_file": "vagrant.key", "ssh_wait_timeout": "60m", "shutdown_command": "shutdown -p now", "boot_wait": "30s", "boot_command": [ "S", "# ~~~ OPACK - OpenBSD Packing ~~~~", "# $(OPACK_COMMIT) ", "ifconfig vio0 inet autoconf & ", "sleep 1 && ", "wait && ", "ftp http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.conf && ", "ftp http://{{ .HTTPIP }}:{{ .HTTPPort }}/autodisklabel && ", "install -af install.conf && ", "echo permit nopass :wheel > /mnt/etc/doas.conf && ", "echo inet autoconf > /mnt/etc/hostname.vio0 && ", "echo PubkeyAcceptedAlgorithms +ssh-rsa >> /mnt/etc/ssh/sshd_config && ", "reboot" ] } ], "provisioners": [ { "type": "shell", "scripts": ["$(OPACK_PROVISION_FILE)"] }, { "type": "shell", "inline": ["mkdir -p /home/$(OPACK_SYS_USER)/.ssh; cp /root/.ssh/authorized_keys /home/$(OPACK_SYS_USER)/.ssh/authorized_keys; chown $(OPACK_SYS_USER) /home/$(OPACK_SYS_USER)/.ssh/authorized_keys"] } ], "post-processors": [ [ { "name": "vagrant", "type": "vagrant", "compression_level": 9, "output": "$(OPACK_BOX_FILE)" } ] ] } endef