imageformat

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultOutputName

func DefaultOutputName(stage string, f Format) string

func Package

func Package(f Format, qcow2Path, dest string, opts *PackageOpts) error

func RenderVagrantfile

func RenderVagrantfile(opts VagrantOpts) (string, error)

RenderVagrantfile renders the vagrant-qemu Vagrantfile for opts.

func WriteBoxVagrantfile

func WriteBoxVagrantfile(dest, boxFile, boxName string) error

WriteBoxVagrantfile writes a minimal consumer Vagrantfile next to a .box package: "vagrant up" auto-adds the box from the local file and installs the provider plugin on first run. Credentials, ports, and provider config come from the Vagrantfile embedded in the box itself.

func WriteVagrantfile

func WriteVagrantfile(dest string, opts VagrantOpts) error

WriteVagrantfile renders a vagrant-qemu Vagrantfile at dest that boots the built qcow2 box-less (no vagrant box needed): the user just runs "vagrant up" (the plugin auto-installs on first run).

Types

type Format

type Format int
const (
	Qcow2 Format = iota + 1
	UTM
	Box
)

func ParseFormat

func ParseFormat(s string) (Format, error)

func (Format) Ext

func (f Format) Ext() string

func (Format) String

func (f Format) String() string

type PackageOpts

type PackageOpts struct {
	VarsPath string
	VMName   string
	MemoryMB int
	CPUs     int
	// Vagrant parameterizes the Vagrantfile embedded in a Box package
	// (ImageName is ignored — the box supplies the disk itself).
	Vagrant *VagrantOpts
}

type VagrantOpts

type VagrantOpts struct {
	// ImageName is the qcow2 filename relative to the Vagrantfile.
	// Required for the box-less Vagrantfile; ignored for Box packaging
	// (the box supplies the disk itself).
	ImageName string
	// Box selects the variant embedded in a .box package: no image_path
	// (vagrant copies the box's disk per machine).
	Box bool
	// Username and Password are the Windows account provisioned by the build.
	Username string
	Password string
	// Hostname is passed as the SMBIOS serial; the image's boot task
	// renames the guest to it (effective from the second boot).
	Hostname string
	// SSHPort is the host port vagrant-qemu forwards to the guest's OpenSSH.
	SSHPort int
	// RDPPort is the host port forwarded to the guest's RDP (:3389).
	RDPPort  int
	MemoryGB int
	CPUs     int
}

VagrantOpts parameterizes the generated Vagrantfile. The zero value is filled with the same defaults the build VM uses.

Jump to

Keyboard shortcuts

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