Exemple #1
0
// UdfCreate forms and executes the UDF command for creating the image
func (img Image) UdfCreate() (string, error) {
	fmt.Println("Creating image...")

	imageDir := filepath.Join(img.BaseDir, "image")

	testutils.PrepareTargetDir(imageDir)

	udfCommand := []string{"sudo", "ubuntu-device-flash", "--verbose"}

	if img.Revision != "" {
		panic("img.revision not supported")
	}

	imagePath := img.imagePath(imageDir)

	coreOptions := []string{
		"core", img.Release,
		"--output", imagePath,
		"--channel", img.Channel,
		"--gadget", img.Gadget,
		"--os", img.OS,
		"--kernel", img.Kernel,
		"--developer-mode",
	}

	err := testutils.ExecCommand(append(udfCommand, coreOptions...)...)

	return imagePath, err
}
Exemple #2
0
// UdfCreate forms and executes the UDF command for creating the image
func (img Image) UdfCreate() (string, error) {
	fmt.Println("Creating image...")

	imageDir := filepath.Join(img.baseDir, "image")

	testutils.PrepareTargetDir(imageDir)

	udfCommand := []string{"sudo", "ubuntu-device-flash", "--verbose"}

	if img.revision != "" {
		udfCommand = append(udfCommand, "--revision="+img.revision)
	}

	imagePath := img.imagePath(imageDir)

	coreOptions := []string{
		"core", img.release,
		"--output", imagePath,
		"--channel", img.channel,
		"--developer-mode",
	}

	err := testutils.ExecCommand(append(udfCommand, coreOptions...)...)

	return imagePath, err
}