packer

package
v0.0.0-...-80a59f1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: BSD-3-Clause Imports: 63 Imported by: 0

Documentation

Overview

Package packer builds and deploys a gokrazy image. Called from the old gokr-packer binary and the new gok binary.

Index

Constants

View Source
const MB = 1024 * 1024

Variables

This section is empty.

Functions

func FindExtraFiles

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

func PerPackageConfigForMigration

func PerPackageConfigForMigration(cfg *config.Struct) (map[string]config.PackageConfig, error)

Types

type FileHash

type FileHash struct {
	// Path is relative to the gokrazy instance directory (or absolute).
	Path string `json:"path"`

	// Hash is the SHA256 sum of the file.
	Hash string `json:"hash"`
}

type FileInfo

type FileInfo struct {
	Filename string
	Mode     os.FileMode

	FromHost    string
	FromLiteral string
	SymlinkDest string

	Dirents []*FileInfo
}

type OutputStruct

type OutputStruct struct {
	Path string     `json:",omitempty"`
	Type OutputType `json:",omitempty"`
}

type OutputType

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

type Pack

type Pack struct {
	packer.Pack

	// FileCfg holds an untouched copy
	// of the config file, as it was read from disk.
	FileCfg *config.Struct
	Cfg     *config.Struct
	Output  *OutputStruct
}

func (*Pack) Main

func (pack *Pack) Main(programName string)

func (*Pack) SudoPartition

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

type SBOM

type SBOM struct {
	// ConfigHash is the SHA256 sum of the gokrazy instance config (loaded
	// from config.json).
	ConfigHash FileHash `json:"config_hash"`

	// GoModHashes is list of FileHashes, sorted by path.
	//
	// It contains one entry for each go.mod file that was used to build a
	// gokrazy instance.
	GoModHashes []FileHash `json:"go_mod_hashes"`

	// ExtraFileHashes is list of FileHashes, sorted by path.
	//
	// It contains one entry for each file referenced via ExtraFilePaths:
	// https://gokrazy.org/userguide/instance-config/#packageextrafilepaths
	ExtraFileHashes []FileHash `json:"extra_file_hashes"`
}

type SBOMWithHash

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

func GenerateSBOM

func GenerateSBOM(cfg *config.Struct) ([]byte, SBOMWithHash, error)

GenerateSBOM generates a Software Bills Of Material (SBOM) for the local gokrazy instance. It must be provided with a cfg that hasn't been modified by gok at runtime, as the SBOM should reflect what’s going into gokrazy, not its internal implementation details (i.e. cfg.InternalCompatibilityFlags untouched).

Jump to

Keyboard shortcuts

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