Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in partitionDOS()? #270

Open
michalfita opened this issue Mar 10, 2023 · 0 comments
Open

Bug in partitionDOS()? #270

michalfita opened this issue Mar 10, 2023 · 0 comments

Comments

@michalfita
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant