-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.
Description
Syntax for attaching a description to each boot command. When running Packer with PACKER_LOG=1
it would print the description next to each printed boot command. A bouns would be to allow to set a description for a group of commands. See below where I currently use comments for this. A comment after a boot command is the description of the boot command where a comment by itself on a line represents the description of a group. A group is useful when multiple commands need to be enter on a single installation screen, see Add a user
and Configure network
in the example at the bottom.
Currently the boot_command
is an array of strings. I suggest that the boot commands could be an array of tuples (arrays) of strings or any array of blocks, example:
Current syntax:
boot_command = [
"b<enter><wait5>", // Use default partition sizes
"x<enter><wait5>", // Partition sizes ok
"b<enter><wait10>", // Yes
]
New syntax, array of tuples:
boot_command = [
["b<enter><wait5>", "Use default partition sizes"],
["x<enter><wait5>", "Partition sizes ok"],
["b<enter><wait10>", "Yes"],
]
New syntax, array of blocks:
boot_command = [
{ command = "b<enter><wait5>", description = "Use default partition sizes" },
{ command = "x<enter><wait5>", description = "Partition sizes ok" },
{ command = "b<enter><wait10>", description = "Yes" },
]
Use Case(s)
My use case is that it would simplify handling installation of operating systems that only support an interactive installation. It would simplify two things: editing Packer configuration files and debug when something goes wrong.
Editing Boot Commands
For example, below are all the boot commands I have to install NetBSD, around 50. If I hadn't included comments it would be next to impossible to figure out which boot command to edit when changing the installation. Today comments can be used to improve the issue of editing boot commands but it would be nicer with direct support for this.
Debugging Boot Commands
When initially writing the boot commands for an interactive installation it's very easy to get it wrong, especially how long Packer needs to wait between commands. You want to wait as little as possible but enough to make sure the action has completed. When something goes wrong and Packer just goes on and types boot commands even though the boot step/screen is completely wrong it's difficult to know at which boot command something went wrong. Today one needs to carefully follow along the commands that Packer is typing, the Packer configuration file with comments and the installation screen, all at the same time, to make sure Packer and the installation are in sync. Often one needs to increase the wait time to make it easier to follow along. If Packer could print a description next to each printed boot command it would make it much easier to see at which step Packer and the installation got out of sync. It doesn't help when many of the boot commands are the same, but have a completely different meaning depending on where in the installation process they're typed.
boot_command = [
"a<enter><wait5>", // Installation messages in English
"a<enter><wait5>", // Keyboard type: unchanged
"a<enter><wait5>", // Install NetBSD to hard disk
"b<enter><wait5>", // Yes
"a<enter><wait5>", // Available disks: sd0
"a<enter><wait5>", // Guid Partition Table
"a<enter><wait5>", // This is the correct geometry
"b<enter><wait5>", // Use default partition sizes
"x<enter><wait5>", // Partition sizes ok
"b<enter><wait10>", // Yes
"a<enter><wait>", // Bootblocks selection: Use BIOS console
"d<enter><wait>", // Custom installation
// Distribution set:
"f<enter><wait5>", // Compiler tools
"x<enter><wait5>", // Install selected sets
"a<enter><wait4m>", // Install from: install image media
"<enter><wait5>", // Hit enter to continue
// Configure the additional items as needed
// Change root password
"d<enter><wait5>",
"a<enter><wait5>", // Yes
"${var.root_password}<enter><wait5>", // New password
"${var.root_password}<enter><wait5>", // New password
"${var.root_password}<enter><wait5>", // Retype new password
// Add a user
"o<enter><wait5>",
"${var.secondary_user_username}<enter><wait5>", // username
"a<enter><wait5>", // Add user to group wheel, Yes
"a<enter><wait5>", // User shell, sh
"${var.secondary_user_password}<enter><wait5>", // New password
"${var.secondary_user_password}<enter><wait5>", // New password
"${var.secondary_user_password}<enter><wait5>", // New password
"g<enter><wait5>", // Enable sshd
"h<enter><wait5>", // Enable ntpd
"i<enter><wait5>", // Run ntpdate at boot
// Configure network
"a<enter><wait5>",
"a<enter><wait5>", // first interface
"<enter><wait5>", // Network media type
"a<enter><wait20>", // Perform autoconfiguration, Yes
"<enter><wait5>", // Your DNS domain
"a<enter><wait5>", // Are they OK, Yes
"a<enter><wait5>", // Is the network information correct, Yes
// Enable installation of binary packages
"e<enter><wait5>",
"x<enter><wait2m>",
"<enter><wait5>", // Hit enter to continue
"x<enter><wait5>", // Finished configuring
"<enter><wait5>", // Hit enter to continue
// post install configuration
"e<enter><wait5>", // Utility menu
"a<enter><wait5>", // Run /bin/sh
// shell
"ftp -o /tmp/post_install.sh http://{{.HTTPIP}}:{{.HTTPPort}}/resources/post_install.sh<enter><wait10>",
"sh /tmp/post_install.sh && exit<enter><wait5>",
"x<enter><wait5>", // Exit Utility menu
"d<enter>", // Reboot the computer
]