-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsources.pkr.hcl
114 lines (106 loc) · 4.2 KB
/
sources.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
local "iso_mirror" {
expression = "${var.iso_mirror != "" ? var.iso_name : lookup(var.iso_mirrors, var.iso_mirror_location, "")}"
}
local "iso_name" {
expression = "${var.iso_name != "" ? var.iso_name : join("", ["dfly-x86_64-", var.dfly_version, "_REL.iso"])}"
}
local "iso_url" {
expression = "${var.iso_url != "" ? var.iso_url : join("", [local.iso_mirror, local.iso_name])}"
}
local "iso_checksum" {
expression = "${var.iso_checksum != "" ? var.iso_checksum : lookup(var.iso_checksums, local.iso_name, "")}"
}
source "virtualbox-iso" "dfly" {
iso_url = "${local.iso_url}"
iso_checksum = "${local.iso_checksum}"
guest_os_type = "FreeBSD_64"
headless = "${var.headless}"
disk_size = "${var.disk_size}"
boot_wait = "5s"
boot_command = [
"1<wait${var.login_prompt_time != "" ? var.login_prompt_time : "50s"}>",
"root<enter><wait5s>",
"/sbin/dhclient em0<enter><wait10s>",
"/usr/bin/fetch -o /tmp/install http://{{ .HTTPIP }}:{{ .HTTPPort }}/${var.install_script}<enter><wait1s>",
"/bin/sh /tmp/install install da0 && /bin/sh /tmp/install reboot 0002<enter>"
]
firmware = "efi"
http_directory = "http"
shutdown_command = "/sbin/poweroff"
ssh_username = "${var.ssh_username}"
ssh_password = "${var.ssh_password}"
ssh_timeout = "${var.ssh_timeout}"
vm_name = "dfly-${var.dfly_version}"
hard_drive_interface = "sata"
guest_additions_mode = "disable"
}
source "qemu" "dfly" {
iso_url = "${local.iso_url}"
iso_checksum = "${local.iso_checksum}"
format = "qcow2"
headless = "${var.headless}"
disk_size = "${var.disk_size}"
boot_wait = "3s"
boot_command = [
"1<wait${var.login_prompt_time != "" ? var.login_prompt_time : "70s"}>",
"root<enter><wait5s>",
"/sbin/dhclient vtnet0<enter><wait10s>",
"/usr/bin/fetch -o /tmp/install http://{{ .HTTPIP }}:{{ .HTTPPort }}/${var.install_script}<enter><wait1s>",
"/bin/sh /tmp/install install vbd0 && /bin/sh /tmp/install reboot 0003<enter>"
]
http_directory = "http"
shutdown_command = "/sbin/poweroff"
ssh_username = "${var.ssh_username}"
ssh_password = "${var.ssh_password}"
ssh_timeout = "${var.ssh_timeout}"
vm_name = "dfly-${var.dfly_version}"
net_device = "virtio-net"
disk_interface = "virtio"
# Download from here:
# https://www.kraxel.org/repos/jenkins/edk2/
# Or read: https://wiki.freebsd.org/UEFI
efi_boot = true
efi_firmware_code = "/usr/local/share/OVMF/OVMF_CODE-pure-efi.fd"
efi_firmware_vars = "/usr/local/share/OVMF/OVMF_VARS-pure-efi.fd"
}
source "hyperv-iso" "dfly" {
iso_url = "${local.iso_url}"
iso_checksum = "${local.iso_checksum}"
disk_size = "${var.disk_size}"
boot_wait = "7s"
boot_command = [
"1<wait${var.login_prompt_time != "" ? var.login_prompt_time : "50s"}>",
"root<enter><wait5s>",
"/sbin/dhclient de0<enter><wait10s>",
"/usr/bin/fetch -o /tmp/install http://{{ .HTTPIP }}:{{ .HTTPPort }}/${var.install_script}<enter><wait1s>",
"/bin/sh /tmp/install ad0 && /sbin/shutdown -r now<enter>"
]
http_directory = "http"
shutdown_command = "/sbin/poweroff"
network_legacy = true
ssh_username = "${var.ssh_username}"
ssh_password = "${var.ssh_password}"
ssh_timeout = "${var.ssh_timeout}"
vm_name = "dfly-${var.dfly_version}"
}
source "vmware-iso" "dfly" {
iso_url = "${local.iso_url}"
iso_checksum = "${local.iso_checksum}"
guest_os_type = "freebsd-64"
headless = "${var.headless}"
disk_size = "${var.disk_size}"
boot_wait = "7s"
boot_command = [
"1<wait${var.login_prompt_time != "" ? var.login_prompt_time : "50s"}>",
"root<enter><wait5s>",
"/sbin/dhclient em0<enter><wait10s>",
"/usr/bin/fetch -o /tmp/install http://{{ .HTTPIP }}:{{ .HTTPPort }}/${var.install_script}<enter><wait1s>",
"/bin/sh /tmp/install ${replace(var.dfly_version, ".", "")} && /sbin/shutdown -r now<enter>"
]
http_directory = "http"
shutdown_command = "/sbin/poweroff"
ssh_password = "${var.ssh_password}"
ssh_username = "${var.ssh_username}"
ssh_wait_timeout = "${var.ssh_timeout}"
vm_name = "dfly-${var.fly_version}"
}