82 lines
2.5 KiB
Makefile
82 lines
2.5 KiB
Makefile
define OPACK_PACKER_CLOUD_CONTENT =
|
|
{
|
|
"description": "OpenBSD $(OPACK_SYS_VERSION) $(OPACK_SYS_ARCHITECTURE) cloud",
|
|
"variables": {
|
|
"box_tag": "$(OPACK_SYS_HOSTNAME)-$(OPACK_TARGET)-{{ timestamp }}",
|
|
"disk_size": "$(OPACK_SYS_DISK_SIZE)",
|
|
"memory": "$(OPACK_SYS_MEMORY)",
|
|
"cpus": "$(OPACK_SYS_CPU)",
|
|
"gcloud_account_json": "../../$(GCE_JSON_KEY)",
|
|
"gcloud_project_id": "$(GCE_PROJECT)",
|
|
"version": "$(OPACK_BOX_VERSION)" },
|
|
"builders": [ {
|
|
"type": "qemu",
|
|
"format": "raw",
|
|
"vm_name": "disk.raw",
|
|
"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": "$(OPACK_SYS_SSH_PRIVATE_KEY)",
|
|
"ssh_wait_timeout": "60m",
|
|
"shutdown_command": "shutdown -p now",
|
|
"boot_wait": "30s",
|
|
"boot_command": [ "S<enter><wait>",
|
|
"# ~~~ OPACK - OpenBSD Packing ~~~~<enter>",
|
|
"# $(OPACK_COMMIT) <enter>",
|
|
"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<enter>" ]
|
|
} ],
|
|
"provisioners": [
|
|
{
|
|
"type": "file",
|
|
"source": "$(PROTECME_TOP_DIR)/src",
|
|
"destination": "/root/magma"
|
|
},
|
|
{
|
|
"type": "file",
|
|
"source": "$(PROTECME_SPEC_DIR)/openbsd",
|
|
"destination": "/var/spec2006src"
|
|
},
|
|
{
|
|
"type": "shell",
|
|
"scripts": ["$(OPACK_PROVISION_FILE)"]
|
|
}
|
|
],
|
|
"post-processors": [ [
|
|
{ "name": "Compress",
|
|
"type": "compress",
|
|
"compression_level": 9,
|
|
"output": "disk.raw.tar.gz"
|
|
},
|
|
{ "name": "GCP Import",
|
|
"type": "googlecompute-import",
|
|
"project_id": "{{user `gcloud_project_id`}}",
|
|
"account_file": "{{user `gcloud_account_json`}}",
|
|
"bucket": "$(GCE_BUCKET)",
|
|
"image_name": "$(OPACK_TARGET)",
|
|
"image_description": "$(OPACK_COMMIT)",
|
|
"image_family": "openbsd",
|
|
"keep_input_artifact": true
|
|
}
|
|
] ]
|
|
}
|
|
endef
|