model

package
v0.0.0-...-ffb386f Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DemoVersion is hard coded string we display in log files
	// when running in demo (aka documentation mode). We will
	// now use this as a flag to not include the version in UI.
	DemoVersion = "X.Y.Z"
)

Variables

View Source
var BuildDate = "undefined"

BuildDate is set by the Go linker with the build datetime

View Source
var Version = "undefined"

Version of Clear Installer. Also used by the Makefile for releases. Default to the version of the program but may be overridden for demo/documentation mode. Set by Go linker in the Makefile

Functions

This section is empty.

Types

type FilesystemType

type FilesystemType struct {
	Disk      string `json:"disk"`
	Partition uint64 `json:"partition"`
	Type      string `json:"type"`
	Options   string `json:"options"`
}

FilesystemType describes the filesystem type

type InstallHook

type InstallHook struct {
	Chroot bool   `yaml:"chroot,omitempty,flow"`
	Cmd    string `yaml:"cmd,omitempty,flow"`
}

InstallHook is a commands to be executed in a given point of the install process

type IsterConfig

type IsterConfig struct {
	DestinationType      string                 `json:"DestinationType"`
	PartitionLayouts     []*PartitionLayout     `json:"PartitionLayout"`
	FilesystemTypes      []*FilesystemType      `json:"FilesystemTypes"`
	PartitionMountPoints []*PartitionMountPoint `json:"PartitionMountPoints"`
	Version              UintString             `json:"Version"`
	Bundles              []string               `json:"Bundles"`
	Users                []*User                `json:"Users,omitempty,flow"`
	Hostname             string                 `json:"Hostname,omitempty,flow"`
	StaticIP             *Network               `json:"Static_IP,omitempty,flow"`
	PostNonChroot        []string               `json:"PostNonChroot,omitempty,flow"`
	PostNonChrootShell   []string               `json:"PostNonChrootShell,omitempty,flow"`
	LegacyBios           bool                   `json:"LegacyBios,omitempty,flow"`
	HTTPSProxy           string                 `json:"HTTPSProxy,omitempty,flow"`
	HTTPProxy            string                 `json:"HTTPProxy,omitempty,flow"`
	MirrorURL            string                 `json:"MirrorURL,omitempty,flow"`
	Cmdline              string                 `json:"cmdline,omitempty,flow"`
	VersionURL           string                 `json:"VersionURL,omitempty,flow"`
}

IsterConfig represents the install configuration used in the "ister" app

type Network

type Network struct {
	Iface   string `json:"iface"`
	Address string `json:"address"`
	Gateway string `json:"gateway"`
	DNS     string `json:"dns"`
}

Network describes the network interface details

type PartitionLayout

type PartitionLayout struct {
	Disk      string `json:"disk"`
	Partition uint64 `json:"partition"`
	Size      string `json:"size"`
	Type      string `json:"type"`
}

PartitionLayout describes the partition type

type PartitionMountPoint

type PartitionMountPoint struct {
	Disk      string `json:"disk"`
	Partition uint64 `json:"partition"`
	Mount     string `json:"mount"`
}

PartitionMountPoint describes the mount point

type StorageAlias

type StorageAlias struct {
	Name       string `yaml:"name,omitempty,flow"`
	File       string `yaml:"file,omitempty,flow"`
	DeviceFile bool   `yaml:"devicefile,omitempty,flow"`
}

StorageAlias is used to expand variables in the targetMedia definitions a partition's block device name attribute could be declared in the form of:

Name: ${alias}p1

where ${alias} was previously declared pointing to a block device file such as: block-devices : [

{name: "alias", file: "/dev/nvme0n1"}

]

type SystemInstall

type SystemInstall struct {
	InstallSelected   map[string]storage.InstallTarget `yaml:"-"`
	TargetMedias      []*storage.BlockDevice           `yaml:"targetMedia"`
	NetworkInterfaces []*network.Interface             `yaml:"networkInterfaces,omitempty,flow"`
	Keyboard          *keyboard.Keymap                 `yaml:"keyboard,omitempty,flow"`
	Language          *language.Language               `yaml:"language,omitempty,flow"`
	Bundles           []string                         `yaml:"bundles,omitempty,flow"`
	TargetBundles     []string                         `yaml:"targetBundles,omitempty,flow"`
	UserBundles       []string                         `yaml:"userBundles,omitempty,flow"`
	Offline           bool                             `yaml:"offline,omitempty,flow"`
	HTTPSProxy        string                           `yaml:"httpsProxy,omitempty,flow"`
	Telemetry         *telemetry.Telemetry             `yaml:"telemetry,omitempty,flow"`
	Timezone          *timezone.TimeZone               `yaml:"timezone,omitempty,flow"`
	Users             []*user.User                     `yaml:"users,omitempty,flow"`
	KernelArguments   *kernel.Arguments                `yaml:"kernel-arguments,omitempty,flow"`
	Kernel            *kernel.Kernel                   `yaml:"kernel,omitempty,flow"`
	PostReboot        bool                             `yaml:"postReboot,omitempty,flow"`
	SwupdMirror       string                           `yaml:"swupdMirror,omitempty,flow"`
	AllowInsecureHTTP bool                             `yaml:"allowInsecureHTTP,omitempty,flow"`
	SwupdSkipOptional bool                             `yaml:"swupdSkipOptional,omitempty,flow"`
	PostArchive       *boolset.BoolSet                 `yaml:"postArchive,omitempty,flow"`
	Hostname          string                           `yaml:"hostname,omitempty,flow"`
	AutoUpdate        *boolset.BoolSet                 `yaml:"autoUpdate,flow"`
	TelemetryURL      string                           `yaml:"telemetryURL,omitempty,flow"`
	TelemetryTID      string                           `yaml:"telemetryTID,omitempty,flow"`
	TelemetryPolicy   string                           `yaml:"telemetryPolicy,omitempty,flow"`
	PreInstall        []*InstallHook                   `yaml:"pre-install,omitempty,flow"`
	PostInstall       []*InstallHook                   `yaml:"post-install,omitempty,flow"`
	PostImage         []*InstallHook                   `yaml:"post-image,omitempty,flow"`
	SwupdFormat       string                           `yaml:"swupdFormat,omitempty,flow"`
	Version           uint                             `yaml:"version,omitempty,flow"`
	StorageAlias      []*StorageAlias                  `yaml:"block-devices,omitempty,flow"`
	CopyNetwork       bool                             `yaml:"copyNetwork,omitempty,flow"`
	CopySwupd         bool                             `yaml:"copySwupd,omitempty,flow"`
	Environment       map[string]string                `yaml:"env,omitempty,flow"`
	CryptPass         string                           `yaml:"-"`
	MakeISO           bool                             `yaml:"iso,omitempty,flow"`
	ISOPublisher      string                           `yaml:"isoPublisher,omitempty,flow"`
	ISOApplicationID  string                           `yaml:"isoApplicationId,omitempty,flow"`
	KeepImage         bool                             `yaml:"keepImage,omitempty,flow"`
	LockFile          string                           `yaml:"-"`
	ClearCfFile       string                           `yaml:"-"`
	PreCheckDone      bool                             `yaml:"preCheckDone,omitempty,flow"`
	MediaOpts         storage.MediaOpts                `yaml:",inline"`
}

SystemInstall represents the system install "configuration", the target medias, bundles to install and whatever state a install may require

func JSONtoYAMLConfig

func JSONtoYAMLConfig(cf string) (*SystemInstall, error)

JSONtoYAMLConfig converts the "ister" JSON config to the corresponding YAML config fields and return the model

func LoadFile

func LoadFile(path string, options args.Args) (*SystemInstall, error)

LoadFile loads a model from a yaml file pointed by path

func (*SystemInstall) AddBundle

func (si *SystemInstall) AddBundle(bundle string)

AddBundle adds a new bundle to the data model, we make sure to not duplicate entries

func (*SystemInstall) AddExtraKernelArguments

func (si *SystemInstall) AddExtraKernelArguments(args []string)

AddExtraKernelArguments adds a set of custom extra kernel arguments to be added to the clr-boot-manager configuration

func (*SystemInstall) AddNetworkInterface

func (si *SystemInstall) AddNetworkInterface(iface *network.Interface)

AddNetworkInterface adds an Interface instance to the list of NetworkInterfaces

func (*SystemInstall) AddTargetMedia

func (si *SystemInstall) AddTargetMedia(bd *storage.BlockDevice)

AddTargetMedia adds a BlockDevice instance to the list of TargetMedias if bd was previously added to as a target media its pointer is updated

func (*SystemInstall) AddUser

func (si *SystemInstall) AddUser(usr *user.User)

AddUser adds a new user to the data model, this function also prevents duplicate entries

func (*SystemInstall) AddUserBundle

func (si *SystemInstall) AddUserBundle(bundle string)

AddUserBundle adds a new user bundle to the data model, we make sure to not duplicate entries

func (*SystemInstall) ClearExtraKernelArguments

func (si *SystemInstall) ClearExtraKernelArguments()

ClearExtraKernelArguments clears all of the of custom extra kernel arguments

func (*SystemInstall) ClearInstallSelected

func (si *SystemInstall) ClearInstallSelected()

ClearInstallSelected clears the map of Installation Selected targets

func (*SystemInstall) ClearRemoveKernelArguments

func (si *SystemInstall) ClearRemoveKernelArguments()

ClearRemoveKernelArguments clears all of the of custom remove kernel arguments

func (*SystemInstall) ContainsBundle

func (si *SystemInstall) ContainsBundle(bundle string) bool

ContainsBundle returns true if the data model has a bundle and false otherwise

func (*SystemInstall) ContainsUserBundle

func (si *SystemInstall) ContainsUserBundle(bundle string) bool

ContainsUserBundle returns true if the data model has a user bundle and false otherwise

func (*SystemInstall) EnableTelemetry

func (si *SystemInstall) EnableTelemetry(enable bool)

EnableTelemetry operates on the telemetry flag and enables or disables the target systems telemetry support based in enable argument

func (*SystemInstall) EncryptionRequiresPassphrase

func (si *SystemInstall) EncryptionRequiresPassphrase(isAdvanced bool) bool

EncryptionRequiresPassphrase checks all partition to see if encryption was enabled

func (*SystemInstall) InitializeDefaults

func (si *SystemInstall) InitializeDefaults()

InitializeDefaults ensure defaults are set such as initializing pointer members

func (*SystemInstall) InteractiveOptionsValid

func (si *SystemInstall) InteractiveOptionsValid() error

InteractiveOptionsValid ensures that options which are not appropriate for interactive runs are screened

func (*SystemInstall) IsTargetDesktopInstall

func (si *SystemInstall) IsTargetDesktopInstall() bool

IsTargetDesktopInstall determines if this installation is a Desktop installation by check all bundle lists for any desktop bundles.

func (*SystemInstall) IsTelemetryEnabled

func (si *SystemInstall) IsTelemetryEnabled() bool

IsTelemetryEnabled returns true if telemetry is enabled, false otherwise

func (*SystemInstall) IsTelemetryInstalled

func (si *SystemInstall) IsTelemetryInstalled() bool

IsTelemetryInstalled return true if telemetry tooling is present, false otherwise

func (*SystemInstall) OverrideBundles

func (si *SystemInstall) OverrideBundles(overrideBundles []string)

OverrideBundles replaces the current bundles with the override list Sets the kernel to one of the kernel bundles, the rest remain in the list

func (*SystemInstall) RemoveAllUsers

func (si *SystemInstall) RemoveAllUsers()

RemoveAllUsers remove from the data model all previously added user

func (*SystemInstall) RemoveBundle

func (si *SystemInstall) RemoveBundle(bundle string)

RemoveBundle removes a bundle from the data model

func (*SystemInstall) RemoveKernelArguments

func (si *SystemInstall) RemoveKernelArguments(args []string)

RemoveKernelArguments adds a set of kernel arguments to be "black listed" on clear-boot-manager, meaning these arguments will never end up in the boot manager entry configuration

func (*SystemInstall) RemoveUserBundle

func (si *SystemInstall) RemoveUserBundle(bundle string)

RemoveUserBundle removes a user bundle from the data model

func (*SystemInstall) ResetDefaultSwapFileSize

func (si *SystemInstall) ResetDefaultSwapFileSize()

ResetDefaultSwapFileSize clears the swapfile size unless it has been explicitly set by the YAML or command line

func (*SystemInstall) SetDefaultSwapFileSize

func (si *SystemInstall) SetDefaultSwapFileSize()

SetDefaultSwapFileSize defines the swapfile sized based on the storage default swapfile size

func (*SystemInstall) Validate

func (si *SystemInstall) Validate() error

Validate checks the model for possible inconsistencies or "minimum required" information

func (*SystemInstall) WriteFile

func (si *SystemInstall) WriteFile(path string) error

WriteFile writes a yaml formatted representation of si into the provided file path

func (*SystemInstall) WriteScrubModelTargetMedias

func (si *SystemInstall) WriteScrubModelTargetMedias() (string, error)

WriteScrubModelTargetMedias writes out a copy the model with the TargetMedias removed to a temporary file

func (*SystemInstall) WriteYAMLConfig

func (si *SystemInstall) WriteYAMLConfig(cf string) (string, error)

WriteYAMLConfig writes out the current model to a configuration file If the config file ends in JSON, it renames it to YAML If the file exists, it first makes a backup

type SystemUsage

type SystemUsage struct {
	InstallModel SystemInstall `yaml:",inline"`
	Hypervisor   string        `yaml:"hypervisor,omitempty,flow"`
}

SystemUsage is used to include additional information into the telemetry payload

type UintString

type UintString struct {
	Number uint
}

func (*UintString) UnmarshalJSON

func (us *UintString) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a UintString

type User

type User struct {
	Username string      `json:"username"`
	Key      string      `json:"key"`
	UID      json.Number `json:"uid"`
	Sudo     bool        `json:"sudo"`
	Password string      `json:"password"`
}

User describes the user details

Jump to

Keyboard shortcuts

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