install

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MPL-2.0 Imports: 48 Imported by: 0

Documentation

Overview

Package install provides the installation routine.

Index

Constants

This section is empty.

Variables

View Source
var NoFilesystem = &Target{
	FormatOptions: &partition.FormatOptions{
		FileSystemType: partition.FilesystemTypeNone,
	},
}

NoFilesystem preset to override default filesystem type to none.

Functions

func Install

func Install(ctx context.Context, p runtime.Platform, mode Mode, opts *Options) error

Install installs Talos.

func VerifyDiskAvailability

func VerifyDiskAvailability(devpath, label string) (err error)

VerifyDiskAvailability verifies that no filesystems currently exist with the labels used by the OS.

func VerifyEphemeralPartition

func VerifyEphemeralPartition(opts *Options) (err error)

VerifyEphemeralPartition verifies the supplied data device options.

Types

type Device

type Device struct {
	Device string

	ResetPartitionTable bool
	Zero                bool

	SkipOverlayMountsCheck bool
}

Device represents device options.

type Installer

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

Installer represents the installer logic. It serves as the entrypoint to all installation methods.

func NewInstaller

func NewInstaller(ctx context.Context, cmdline *procfs.Cmdline, mode Mode, opts *Options) (i *Installer, err error)

NewInstaller initializes and returns an Installer.

func (*Installer) Install

func (i *Installer) Install(ctx context.Context, mode Mode) (err error)

Install fetches the necessary data locations and copies or extracts to the target locations.

type Manifest

type Manifest struct {
	PartitionOptions  *runtime.PartitionOptions
	Devices           map[string]Device
	Targets           map[string][]*Target
	LegacyBIOSSupport bool

	Printf func(string, ...any)
}

Manifest represents the instructions for preparing all block devices for an installation.

func NewManifest

func NewManifest(mode Mode, uefiOnlyBoot bool, bootLoaderPresent bool, opts *Options) (manifest *Manifest, err error)

NewManifest initializes and returns a Manifest.

func (*Manifest) Execute

func (m *Manifest) Execute() (err error)

Execute partitions and formats all disks in a manifest.

func (*Manifest) SystemMountpoints

func (m *Manifest) SystemMountpoints(ctx context.Context, opts ...mount.Option) (*mount.Points, error)

SystemMountpoints returns list of system mountpoints for the manifest.

type MetaValues added in v1.4.0

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

MetaValues is a list of MetaValue.

func FromMeta added in v1.5.0

func FromMeta(values meta.Values) MetaValues

FromMeta returns a new MetaValues from a meta.Values.

func (*MetaValues) Append added in v1.4.0

func (s *MetaValues) Append(val string) error

Append implements pflag.SliceValue.

func (*MetaValues) Decode added in v1.4.6

func (s *MetaValues) Decode(val string) error

Decode the values from the given string.

func (*MetaValues) Encode added in v1.4.6

func (s *MetaValues) Encode() string

Encode returns the encoded values.

func (*MetaValues) GetMetaValues added in v1.5.0

func (s *MetaValues) GetMetaValues() meta.Values

GetMetaValues returns the wrapped meta.Values.

func (*MetaValues) GetSlice added in v1.4.0

func (s *MetaValues) GetSlice() []string

GetSlice implements pflag.SliceValue.

func (*MetaValues) Replace added in v1.4.0

func (s *MetaValues) Replace(val []string) error

Replace implements pflag.SliceValue.

func (*MetaValues) Set added in v1.4.0

func (s *MetaValues) Set(val string) error

Set implements pflag.Value.

func (*MetaValues) String added in v1.4.0

func (s *MetaValues) String() string

String implements pflag.Value.

func (*MetaValues) Type added in v1.4.0

func (s *MetaValues) Type() string

Type implements pflag.Value.

type Mode added in v1.5.0

type Mode int

Mode is the install mode.

const (
	// ModeInstall is the install mode.
	ModeInstall Mode = iota
	// ModeUpgrade is the upgrade mode.
	ModeUpgrade
	// ModeImage is the image creation mode.
	ModeImage
)

func (Mode) IsImage added in v1.5.0

func (m Mode) IsImage() bool

IsImage returns true if the mode is image creation.

type Options

type Options struct {
	ConfigSource        string
	Disk                string
	Platform            string
	Arch                string
	Board               string
	ExtraKernelArgs     []string
	Upgrade             bool
	Force               bool
	Zero                bool
	LegacyBIOSSupport   bool
	MetaValues          MetaValues
	OverlayInstaller    overlay.Installer[overlay.ExtraOptions]
	OverlayName         string
	OverlayExtractedDir string
	ExtraOptions        overlay.ExtraOptions

	// Options specific for the image creation mode.
	ImageSecureboot bool
	Version         string
	BootAssets      bootloaderoptions.BootAssets
	Printf          func(string, ...any)
	MountPrefix     string
}

Options represents the set of options available for an install.

type PreflightChecks

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

PreflightChecks runs the preflight checks.

func NewPreflightChecks

func NewPreflightChecks(ctx context.Context) (*PreflightChecks, error)

NewPreflightChecks initializes and returns the installation PreflightChecks.

func (*PreflightChecks) Close

func (checks *PreflightChecks) Close() error

Close closes the client.

func (*PreflightChecks) Run

func (checks *PreflightChecks) Run(ctx context.Context) error

Run the checks, return the error if the check fails.

type PreserveSource

type PreserveSource struct {
	Label          string
	FnmatchFilters []string
	FileSystemType partition.FileSystemType
}

PreserveSource instructs Talos where to look for source files to preserve.

type Target

type Target struct {
	*partition.FormatOptions
	*partition.Options
	Device string

	LegacyBIOSBootable bool

	// Preserve contents of the partition with the same label (if it exists).
	PreserveContents bool

	// Extra preserved locations (for upgrading from older versions of Talos).
	//
	// Used only if PreserveContents is true.
	ExtraPreserveSources []PreserveSource

	// Skip makes manifest skip any actions with the partition (creating, formatting).
	//
	// Skipped partitions should exist on the disk by the time manifest execution starts.
	Skip bool

	// set during execution
	PartitionName string
	Contents      *bytes.Buffer
}

Target represents an installation partition.

func BIOSTarget

func BIOSTarget(device string, extra *Target) *Target

BIOSTarget builds the default BIOS target.

func BootTarget

func BootTarget(device string, extra *Target) *Target

BootTarget builds the default boot target.

func EFITarget

func EFITarget(device string, extra *Target) *Target

EFITarget builds the default EFI target.

func EFITargetUKI added in v1.5.0

func EFITargetUKI(device string, extra *Target) *Target

EFITargetUKI builds the default EFI UKI target.

func EphemeralTarget

func EphemeralTarget(device string, extra *Target) *Target

EphemeralTarget builds the default ephemeral target.

func MetaTarget

func MetaTarget(device string, extra *Target) *Target

MetaTarget builds the default meta target.

func ParseTarget added in v1.4.0

func ParseTarget(label, deviceName string) (*Target, error)

ParseTarget parses the target from the label and creates a required target.

func StateTarget

func StateTarget(device string, extra *Target) *Target

StateTarget builds the default state target.

func (*Target) Format

func (t *Target) Format(printf func(string, ...any)) error

Format creates a filesystem on the device/partition.

func (*Target) GetLabel

func (t *Target) GetLabel() string

GetLabel returns the underlaying partition label.

func (*Target) Locate

func (t *Target) Locate(pt *gpt.GPT) (*gpt.Partition, error)

Locate existing partition on the disk.

func (*Target) RestoreContents

func (t *Target) RestoreContents() error

RestoreContents restores previously saved contents to the disk.

func (*Target) SaveContents

func (t *Target) SaveContents(device Device, source *gpt.Partition, fileSystemType partition.FileSystemType, fnmatchFilters []string) error

SaveContents saves contents of partition to the target (in-memory).

func (*Target) String

func (t *Target) String() string

Jump to

Keyboard shortcuts

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