install

package
v0.0.0-...-7f9afe8 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: GPL-3.0 Imports: 25 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMissingPartitions

func CreateMissingPartitions(dv *gadget.OnDiskVolume, gv *gadget.Volume, opts *CreateOptions) ([]*gadget.OnDiskAndGadgetStructurePair, error)

CreateMissingPartitions calls createMissingPartitions but returns only OnDiskStructure, as it is meant to be used externally (i.e. by muinstaller).

func KeysForRole

func KeysForRole(setupData *EncryptionSetupData) map[string]keys.EncryptionKey

func MatchDisksToGadgetVolumes

func MatchDisksToGadgetVolumes(gVols map[string]*gadget.Volume,
	volCompatOpts *gadget.VolumeCompatibilityOptions) (map[string]map[int]*gadget.OnDiskStructure, error)

MatchDisksToGadgetVolumes matches gadget volumes with disks present in the system, taking into account the provided compatibility options. It returns a map of volume names to maps of gadget structure yaml indices to real disk structures.

func MountVolumes

func MountVolumes(onVolumes map[string]*gadget.Volume, encSetupData *EncryptionSetupData) (seedMntDir string, unmount func() error, err error)

MountVolumes mounts partitions for the volumes specified by onVolumes. It returns the partition with the system-seed{,-null} role and a function that needs to be called for unmounting them.

func SaveStorageTraits

func SaveStorageTraits(model gadget.Model, vols map[string]*gadget.Volume, encryptSetupData *EncryptionSetupData) error

func WriteContent

func WriteContent(onVolumes map[string]*gadget.Volume, allLaidOutVols map[string]*gadget.LaidOutVolume, encSetupData *EncryptionSetupData, kSnapInfo *KernelSnapInfo, observer gadget.ContentObserver, perfTimings timings.Measurer) ([]*gadget.OnDiskVolume, error)

WriteContent writes gadget content to the devices specified in onVolumes. It returns the resolved on disk volumes.

Types

type CreateOptions

type CreateOptions struct {
	// The gadget root dir
	GadgetRootDir string

	// Create all missing partitions. If unset only
	// role-{data,boot,save} partitions will get created and it's
	// an error if other partition are missing.
	CreateAllMissingPartitions bool
}

type EncryptionSetupData

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

EncryptionSetupData stores information needed across install API calls.

func EncryptPartitions

func EncryptPartitions(onVolumes map[string]*gadget.Volume, encryptionType secboot.EncryptionType, model *asserts.Model, gadgetRoot, kernelRoot string, perfTimings timings.Measurer) (*EncryptionSetupData, error)

func MockEncryptionSetupData

func MockEncryptionSetupData(labelToEncDevice map[string]*MockEncryptedDeviceAndRole) *EncryptionSetupData

MockEncryptionSetupData is meant to be used for unit tests from other packages.

func (*EncryptionSetupData) EncryptedDevices

func (esd *EncryptionSetupData) EncryptedDevices() map[string]string

EncryptedDevices returns a map partition role -> LUKS mapper device.

type InstalledSystemSideData

type InstalledSystemSideData struct {
	// KeysForRoles contains key sets for the relevant structure roles.
	KeyForRole map[string]keys.EncryptionKey
	// DeviceForRole maps a roles to their corresponding device nodes. For
	// structures with roles that require data to be encrypted, the device
	// is the raw encrypted device node (eg. /dev/mmcblk0p1).
	DeviceForRole map[string]string
}

InstalledSystemSideData carries side data of an installed system, eg. secrets to access its partitions.

func FactoryReset

func FactoryReset(model gadget.Model, gadgetRoot string, kernelSnapInfo *KernelSnapInfo, bootDevice string, options Options, observer gadget.ContentObserver, perfTimings timings.Measurer) (*InstalledSystemSideData, error)

func Run

func Run(model gadget.Model, gadgetRoot string, kernelSnapInfo *KernelSnapInfo, bootDevice string, options Options, observer gadget.ContentObserver, perfTimings timings.Measurer) (*InstalledSystemSideData, error)

Run creates partitions, encrypts them when expected, creates filesystems, and finally writes content on them.

type KernelSnapInfo

type KernelSnapInfo struct {
	Name     string
	Revision snap.Revision
	// MountPoint is the root of the files from the kernel snap
	MountPoint string
	// NeedsDriversTree will be set if a drivers tree needs to be
	// build on installation
	NeedsDriversTree bool
	// IsCore is set if this is UC
	IsCore bool
}

KernelSnapInfo includes information from the kernel snap that is needed to build a drivers tree.

type MockEncryptedDeviceAndRole

type MockEncryptedDeviceAndRole struct {
	Role            string
	EncryptedDevice string
}

MockEncryptedDeviceAndRole is meant to be used for unit tests from other packages.

type Options

type Options struct {
	// Also mount the filesystems after creation
	Mount bool
	// Encrypt the data/save partitions
	EncryptionType secboot.EncryptionType
}

Jump to

Keyboard shortcuts

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