packer

package
v0.0.0-...-2219c39 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: BSD-3-Clause Imports: 61 Imported by: 0

Documentation

Overview

Package packer builds and deploys a gokrazy image.

Index

Constants

View Source
const MB = 1024 * 1024

Variables

View Source
var (
	FAT   = byte(0xc)
	Linux = byte(0x83)
)
View Source
var BuildTimestampOverride = BuildTimestampOverrideKey{}

Functions

func FindConfig

func FindConfig(explicit string) (string, error)

FindConfig discovers config.json by walking up from cwd (or using the explicit path).

func FindExtraFiles

func FindExtraFiles(cfg *config.Struct) (map[string][]*FileInfo, error)

func FindModuleRoot

func FindModuleRoot(dir string) (string, error)

FindModuleRoot walks up from dir to find go.mod.

func PermSizeInKB

func PermSizeInKB(firstPartitionOffsetSectors int64, devsize uint64) uint32

Types

type BuildTimestampOverrideKey

type BuildTimestampOverrideKey struct{}

type Env

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

Env holds the environment for a Pack operation.

func NewEnv

func NewEnv(logger Logger) Env

func (*Env) Logger

func (e *Env) Logger() Logger

type FileHash

type FileHash struct {
	Path string `json:"path"`
	Hash string `json:"hash"`
}

type FileInfo

type FileInfo struct {
	Filename string
	Mode     os.FileMode

	FromHost    string
	FromLiteral string
	SymlinkDest string

	Dirents []*FileInfo
}

type GoPackage

type GoPackage struct {
	Path      string `json:"path"`
	BuildID   string
	BuildInfo string
}

type Logger

type Logger interface {
	Printf(msg string, a ...any)
	Output(calldepth int, s string) error
}

Logger is the logger interface used by the packer.

type Output

type Output struct {
	Type OutputType
	Path string
}

Output holds overwrite output config.

type OutputType

type OutputType string

OutputType distinguishes between full disk image and gaf.

const (
	OutputTypeFull OutputType = "full"
	OutputTypeGaf  OutputType = "gaf"
)

type Pack

type Pack struct {
	Env     Env
	Cfg     *config.Struct
	FileCfg *config.Struct // cfg before internal modifications
	Pack    PackerPack
	Output  *Output
	// contains filtered or unexported fields
}

Pack is the core packer state.

func NewPack

func NewPack(cfg *config.Struct, moduleRoot string) *Pack

NewPack creates a new Pack with the given config and module root.

func (*Pack) BuildDir

func (pack *Pack) BuildDir(pkg string) (string, error)

BuildDir returns the module root, regardless of the package.

func (*Pack) PackageDir

func (pack *Pack) PackageDir(pkg string) (string, error)

func (*Pack) RunOverwrite

func (pack *Pack) RunOverwrite(ctx context.Context) error

func (*Pack) RunUpdate

func (pack *Pack) RunUpdate(ctx context.Context) error

func (*Pack) SudoPartition

func (p *Pack) SudoPartition(path string) (*os.File, error)

type PackerPack

type PackerPack struct {
	Partuuid       uint32
	UsePartuuid    bool
	UseGPTPartuuid bool
	UseGPT         bool
	ExistingEEPROM struct {
		PieepromSHA256 string
		VL805SHA256    string
	}
	FirstPartitionOffsetSectors int64
}

PackerPack represents one pack process (partition-level).

func NewPackForHost

func NewPackForHost(firstPartitionOffsetSectors int64, hostname string) PackerPack

func (*PackerPack) GPTPARTUUID

func (p *PackerPack) GPTPARTUUID(partition uint16) string

func (*PackerPack) ModifyCmdlineRoot

func (p *PackerPack) ModifyCmdlineRoot() bool

func (*PackerPack) Partition

func (p *PackerPack) Partition(o *os.File, devsize uint64) error

func (*PackerPack) PermUUID

func (p *PackerPack) PermUUID() string

func (*PackerPack) RereadPartitions

func (p *PackerPack) RereadPartitions(o *os.File) error

func (*PackerPack) Root

func (p *PackerPack) Root() string

type SBOM

type SBOM struct {
	ConfigHash      FileHash    `json:"config_hash"`
	ExtraFileHashes []FileHash  `json:"extra_file_hashes"`
	GoPackages      []GoPackage `json:"go_packages"`
}

type SBOMWithHash

type SBOMWithHash struct {
	SBOMHash string `json:"sbom_hash"`
	SBOM     SBOM   `json:"sbom"`
}

Jump to

Keyboard shortcuts

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