@@ -114,6 +114,26 @@ variable "hostname_step" {
114
114
description = " Step to set hostname"
115
115
}
116
116
117
+ variable "keyboard_layout_steps" {
118
+ type = list (list (string ))
119
+ description = " Step to select keyboard layout"
120
+ }
121
+
122
+ variable "correct_geometry_steps" {
123
+ type = list (list (string ))
124
+ description = " Step to say the geometry is correct"
125
+ }
126
+
127
+ variable "bootblock_selection_steps" {
128
+ type = list (list (string ))
129
+ description = " Step to select bootblock"
130
+ }
131
+
132
+ variable "post_install_disk_device" {
133
+ type = string
134
+ description = " The disk device to mount during post install"
135
+ }
136
+
117
137
locals {
118
138
iso_target_extension = " iso"
119
139
iso_target_path = " packer_cache"
@@ -139,27 +159,37 @@ source "qemu" "qemu" {
139
159
display = var. display
140
160
accelerator = var. accelerator
141
161
qemu_binary = " qemu-system-${ var . architecture . qemu } "
142
- // firmware = var.firmware
162
+ firmware = var. firmware
143
163
144
164
boot_wait = " 10s"
145
165
146
166
boot_steps = concat (
147
167
[
148
- [" a<enter><wait5>" , " Installation messages in English" ],
149
- [" a<enter><wait5>" , " Keyboard type: unchanged" ],
168
+ [" 1<wait20s>" , " Boot normally" ], // for x86-64, the boot delay is already over
169
+ [" a<enter><wait5>" , " Installation messages in English" ]
170
+ ],
171
+
172
+ var. keyboard_layout_steps ,
150
173
174
+ [
151
175
[" a<enter><wait5>" , " Install NetBSD to hard disk" ],
152
176
[" b<enter><wait5>" , " Yes" ],
153
177
154
178
[" a<enter><wait5>" , " Available disks: sd0" ],
155
179
[" a<enter><wait5>" , " Guid Partition Table" ],
156
- [" a<enter><wait5>" , " This is the correct geometry" ],
180
+ ],
181
+
182
+ var. correct_geometry_steps ,
183
+
184
+ [
157
185
[" b<enter><wait5>" , " Use default partition sizes" ],
158
186
[" x<enter><wait5>" , " Partition sizes ok" ],
159
187
[" b<enter><wait10>" , " Yes" ],
188
+ ],
160
189
161
- [ " a<enter><wait> " , " Bootblocks selection: Use BIOS console " ] ,
190
+ var . bootblock_selection_steps ,
162
191
192
+ [
163
193
[" d<enter><wait>" , " Custom installation" ],
164
194
// Distribution set:
165
195
[" f<enter><wait5>" , " Compiler tools" ],
@@ -170,7 +200,7 @@ source "qemu" "qemu" {
170
200
// Distribution set:
171
201
[" x<enter><wait5>" , " Install selected sets" ],
172
202
173
- [" a<enter><wait4m >" , " Install from: install image media" ],
203
+ [" a<enter><wait5m >" , " Install from: install image media" ],
174
204
175
205
[" <enter><wait5>" , " Hit enter to continue" ],
176
206
@@ -181,7 +211,6 @@ source "qemu" "qemu" {
181
211
182
212
[
183
213
// Change root password
184
- flatten (var. root_password_pre_steps ),
185
214
[" ${ var . root_password } <enter><wait5>" , " New password" ],
186
215
[" ${ var . root_password } <enter><wait5>" , " New password" ],
187
216
[" ${ var . root_password } <enter><wait5>" , " Retype new password" ],
@@ -217,10 +246,10 @@ source "qemu" "qemu" {
217
246
[" a<enter><wait5>" , " Are they OK, Yes" ],
218
247
[" a<enter><wait5>" , " Is the network information correct, Yes" ],
219
248
220
- // Enable installation of binary packages
221
- /* ["e<enter><wait5>"],
222
- ["x<enter><wait2m>", "Install pkgin and update package summary"],
223
- ["<enter><wait5>", "Hit enter to continue"],*/
249
+ // // Enable installation of binary packages
250
+ // ["e<enter><wait5>"],
251
+ // ["x<enter><wait2m>", "Install pkgin and update package summary"],
252
+ // ["<enter><wait5>", "Hit enter to continue"],
224
253
225
254
[" x<enter><wait5>" , " Finished configuring" ],
226
255
[" <enter><wait5>" , " Hit enter to continue" ],
@@ -231,7 +260,7 @@ source "qemu" "qemu" {
231
260
232
261
// shell
233
262
[" ftp -o /tmp/post_install.sh http://{{.HTTPIP}}:{{.HTTPPort}}/resources/post_install.sh<enter><wait10>" ],
234
- [" sh /tmp/post_install.sh && exit<enter><wait5>" ],
263
+ [" DISK_DEVICE=' ${ var . post_install_disk_device } ' sh /tmp/post_install.sh && exit<enter><wait5>" ],
235
264
236
265
[" x<enter><wait5>" , " Exit Utility menu" ],
237
266
[" d<enter>" , " Reboot the computer" ],
@@ -251,7 +280,6 @@ source "qemu" "qemu" {
251
280
[" -device" , " scsi-cd,drive=drive1,bootindex=1" ],
252
281
[" -drive" , " if=none,file={{ .OutputDir }}/{{ .Name }},id=drive0,cache=writeback,discard=ignore,format=qcow2" ],
253
282
[" -drive" , " if=none,file=${ local . iso_full_target_path } ,id=drive1,media=disk,format=raw,readonly=on" ],
254
- [" -serial" , " stdio" ],
255
283
[" -netdev" , " user,id=user.0,hostfwd=tcp::{{ .SSHHostPort }}-:22,ipv6=off" ]
256
284
]
257
285
0 commit comments