builder

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "yuval-k.arm-image"
View Source
const ChrootKey = "mount_path"
View Source
const SectorShift = 9

sector size is 512 bytes

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	Args               []string
	PathToQemuInChroot string
}

type Artifact

type Artifact struct {
	StateData map[string]interface{}
	// contains filtered or unexported fields
}

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (a *Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) ConfigSpec

func (b *Builder) ConfigSpec() hcldec.ObjectSpec

func (*Builder) Prepare

func (b *Builder) Prepare(cfgs ...interface{}) ([]string, []string, error)

func (*Builder) Run

func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error)

type Config

type Config struct {
	packer_common_common.PackerConfig `mapstructure:",squash"`
	// While arm image are not ISOs, we resuse the ISO logic as it basically has no ISO specific code.
	// Provide the arm image in the iso_url fields.
	packer_common_commonsteps.ISOConfig `mapstructure:",squash"`

	// Lets you prefix all builder commands, such as with ssh for a remote build host. Defaults to "".
	// Copied from other builders :)
	CommandWrapper string `mapstructure:"command_wrapper"`

	// Output directory, where the final image will be stored.
	// Deprecated - Use OutputFile instead
	OutputDir string `mapstructure:"output_directory"`

	// Output filename, where the final image will be stored
	OutputFile string `mapstructure:"output_filename"`

	// Image type. this is used to deduce other settings like image mounts and qemu args.
	// If not provided, we will try to deduce it from the image url. (see autoDetectType())
	// For list of valid values, see: pkg/image/utils/images.go
	ImageType utils.KnownImageType `mapstructure:"image_type"`

	// Image's target CPU architecture.
	// This is used to determine if qemu is necessary and which flavor to use.
	// Defaults to "arm". For list of valid values, see: pkg/image/arch/arch.go
	ImageArch arch.KnownArchType `mapstructure:"image_arch"`

	// Where to mounts the image partitions in the chroot.
	// first entry is the mount point of the first partition. etc..
	ImageMounts []string `mapstructure:"image_mounts"`

	// The path where the volume will be mounted. This is where the chroot environment will be.
	// Will be a temporary directory if left unspecified.
	MountPath string `mapstructure:"mount_path"`

	// What directories mount from the host to the chroot.
	// leave it empty for reasonable defaults.
	// array of triplets: [type, device, mntpoint].
	ChrootMounts [][]string `mapstructure:"chroot_mounts"`

	// What directories mount from the host to the chroot, in addition to the default ones.
	// Use this instead of `chroot_mounts` if you want to add to the existing defaults instead of
	// overriding them
	// array of triplets: [type, device, mntpoint].
	// for example: `["bind", "/run/systemd", "/run/systemd"]`
	AdditionalChrootMounts [][]string `mapstructure:"additional_chroot_mounts"`

	// Can be one of: off, copy-host, bind-host, delete. Defaults to off
	ResolvConf ResolvConfBehavior `mapstructure:"resolv-conf"`

	// Should the last partition be extended? this only works for the last partition in the
	// dos partition table, and ext filesystem
	LastPartitionExtraSize uint64 `mapstructure:"last_partition_extra_size"`
	// The target size of the final image. The last partition will be extended to
	// fill up this much room. I.e. if the generated image is 256MB and TargetImageSize
	// is set to 384MB the last partition will be extended with an additional 128MB.
	TargetImageSize uint64 `mapstructure:"target_image_size"`

	// Qemu binary to use. default is determined based on `image_arch`.
	// If this is an absolute path, it will be used. Otherwise, we will look for one in your PATH
	// and finally, try to auto fetch one from https://github.com/multiarch/qemu-user-static/
	QemuBinary string `mapstructure:"qemu_binary"`
	// Do not use embedded qemu.
	DisableEmbedded bool `mapstructure:"disable_embedded"`
	// Arguments to qemu binary. default depends on the image type. see init() function above.
	QemuArgs []string `mapstructure:"qemu_args"`
	// Use qemu even when the build machine's CPU architecture matches the image's CPU architecture.
	// Defaults to true if non-default `qemu_binary` or `qemu_args` are supplied.
	QemuRequired bool `mapstructure:"qemu_required"`
	// contains filtered or unexported fields
}

func (*Config) FlatMapstructure

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type FlatConfig

type FlatConfig struct {
	PackerBuildName        *string               `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"`
	PackerBuilderType      *string               `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"`
	PackerCoreVersion      *string               `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"`
	PackerDebug            *bool                 `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"`
	PackerForce            *bool                 `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"`
	PackerOnError          *string               `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"`
	PackerUserVars         map[string]string     `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"`
	PackerSensitiveVars    []string              `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"`
	ISOChecksum            *string               `mapstructure:"iso_checksum" required:"true" cty:"iso_checksum" hcl:"iso_checksum"`
	RawSingleISOUrl        *string               `mapstructure:"iso_url" required:"true" cty:"iso_url" hcl:"iso_url"`
	ISOUrls                []string              `mapstructure:"iso_urls" cty:"iso_urls" hcl:"iso_urls"`
	TargetPath             *string               `mapstructure:"iso_target_path" cty:"iso_target_path" hcl:"iso_target_path"`
	TargetExtension        *string               `mapstructure:"iso_target_extension" cty:"iso_target_extension" hcl:"iso_target_extension"`
	CommandWrapper         *string               `mapstructure:"command_wrapper" cty:"command_wrapper" hcl:"command_wrapper"`
	OutputDir              *string               `mapstructure:"output_directory" cty:"output_directory" hcl:"output_directory"`
	OutputFile             *string               `mapstructure:"output_filename" cty:"output_filename" hcl:"output_filename"`
	ImageType              *utils.KnownImageType `mapstructure:"image_type" cty:"image_type" hcl:"image_type"`
	ImageArch              *arch.KnownArchType   `mapstructure:"image_arch" cty:"image_arch" hcl:"image_arch"`
	ImageMounts            []string              `mapstructure:"image_mounts" cty:"image_mounts" hcl:"image_mounts"`
	MountPath              *string               `mapstructure:"mount_path" cty:"mount_path" hcl:"mount_path"`
	ChrootMounts           [][]string            `mapstructure:"chroot_mounts" cty:"chroot_mounts" hcl:"chroot_mounts"`
	AdditionalChrootMounts [][]string            `mapstructure:"additional_chroot_mounts" cty:"additional_chroot_mounts" hcl:"additional_chroot_mounts"`
	ResolvConf             *ResolvConfBehavior   `mapstructure:"resolv-conf" cty:"resolv-conf" hcl:"resolv-conf"`
	LastPartitionExtraSize *uint64               `mapstructure:"last_partition_extra_size" cty:"last_partition_extra_size" hcl:"last_partition_extra_size"`
	TargetImageSize        *uint64               `mapstructure:"target_image_size" cty:"target_image_size" hcl:"target_image_size"`
	QemuBinary             *string               `mapstructure:"qemu_binary" cty:"qemu_binary" hcl:"qemu_binary"`
	DisableEmbedded        *bool                 `mapstructure:"disable_embedded" cty:"disable_embedded" hcl:"disable_embedded"`
	QemuArgs               []string              `mapstructure:"qemu_args" cty:"qemu_args" hcl:"qemu_args"`
	QemuRequired           *bool                 `mapstructure:"qemu_required" cty:"qemu_required" hcl:"qemu_required"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.

type ResolvConfBehavior

type ResolvConfBehavior string
const (
	Off      ResolvConfBehavior = "off"
	CopyHost ResolvConfBehavior = "copy-host"
	BindHost ResolvConfBehavior = "bind-host"
	Delete   ResolvConfBehavior = "delete"
)

type StepMountCleanup added in v0.2.2

type StepMountCleanup struct {
}

StepMountCleanup mounts the attached device.

Produces:

mount_extra_cleanup CleanupFunc - To perform early cleanup

func (*StepMountCleanup) Cleanup added in v0.2.2

func (s *StepMountCleanup) Cleanup(state multistep.StateBag)

func (*StepMountCleanup) Run added in v0.2.2

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL