In the function partitionDOS() I had to make change to get this to work:
func partitionDOS(ui packer.Ui, config *Config) multistep.StepAction {
lines := []string{
"label: dos",
fmt.Sprintf("device: %s", config.ImageConfig.ImagePath),
"unit: sectors",
}
ui.Message(
fmt.Sprintf("creating %d dos partitions on %s",
len(config.ImageConfig.ImagePartitions),
config.ImageConfig.ImagePath),
)
for i, partition := range config.ImageConfig.ImagePartitions {
line := fmt.Sprintf(
"%s%d: type=%s",
partition.Name, //config.ImageConfig.ImagePath,
i+1,
partition.Type,
)
// ...
the line input fed into sfdisk shall contain partition names declared, not path to the image. Then to get any output from stderr I had to add:
stderr, err := cmd.StderrPipe()
if err != nil {
ui.Error(fmt.Sprintf("error while getting stderr pipe %v", err))
return multistep.ActionHalt
}
defer stderr.Close()
and replace:
out, _ := io.ReadAll(stdout)
with
out, _ := io.ReadAll(stderr)
But I'm by any means Go expert and these can probably be fixed in a better way.
In the function
partitionDOS()I had to make change to get this to work:the line input fed into
sfdiskshall contain partition names declared, not path to the image. Then to get any output fromstderrI had to add:and replace:
with
But I'm by any means Go expert and these can probably be fixed in a better way.