swupd

package
v0.0.0-...-05f81da Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// MirrorTitle specifies title of swupd mirror
	MirrorTitle = "Mirror URL"

	// MirrorDesc1 specifies line 1 of swupd mirror desc
	MirrorDesc1 = "Specify a different installation source (swupd) URL than the default."

	// MirrorDesc2 specifies line 2 of swupd mirror desc
	MirrorDesc2 = "HTTPS sites must use a publicly signed CA."

	// MirrorAllowInsecure specifies allow test regarding enable insecure installs
	MirrorAllowInsecure = "Allow installation over insecure connections (http://)"

	// AutoUpdateTitle specifies title of auto updates
	AutoUpdateTitle = "Automatic OS Updates"

	// AutoUpdateDesc1 specifies line 1 of auto updates desc
	AutoUpdateDesc1 = "Allow Clear Linux* OS to continuously update as new versions are released."

	// AutoUpdateDesc2 specifies line 2 of auto updates desc
	AutoUpdateDesc2 = "This is the default, preferred behavior for Clear Linux* OS to ensure that the latest" +
		" " + "security concerns are always addressed."

	// AutoUpdateDesc3 specifies line 3 of auto updates desc
	AutoUpdateDesc3 = "To enable this post installation use:"

	// AutoUpdateDesc4 specifies line 4 of auto updates desc
	AutoUpdateDesc4 = "See %s for more information."

	// AutoUpdateCommand specifies auto updates enable command
	AutoUpdateCommand = "\"swupd autoupdate --enable\""

	// AutoUpdateLink specifies document link of auto updates
	AutoUpdateLink = "https://docs.01.org/clearlinux/guides/clear/swupd.html"

	// AutoUpdateLabel specifies label of auto updates
	AutoUpdateLabel = "Enable Auto Updates"

	// AutoUpdateWarning1 specifies part 1 of auto updates warning
	AutoUpdateWarning1 = "WARNING: Disabling Automatic OS Updates puts the system at risk of "

	// AutoUpdateWarning2 specifies part 2 of auto updates desc
	AutoUpdateWarning2 = "missing critical security patches."

	// InvalidURL specifies invalid url error message
	InvalidURL = "Invalid URL: Use HTTPS"

	// IncorrectMirror specifies incorrect mirror error message
	IncorrectMirror = "Mirror not set correctly"

	TargetPrefix = "Target OS: "

	OfflinePrefix = "Offline Content: "

	IsoPrefix = "ISO Initrd: "
)

Variables

View Source
var (
	// CoreBundles represents the core bundles installed in the Verify() operation
	CoreBundles = []string{
		"os-core",
		"os-core-update",
		"openssh-server",
	}
)

Functions

func CopyConfigurations

func CopyConfigurations(rootDir string)

CopyConfigurations transfer the swupd override files to the target installation media

func CreateConfig

func CreateConfig(rootDir string)

CreateConfig create swupd config file in the targets /etc directory to allow http for URLs

func GetHostMirror

func GetHostMirror() (string, error)

GetHostMirror executes the "swupd mirror" to find the Host's mirror

func IsCoreBundle

func IsCoreBundle(bundle string) bool

IsCoreBundle checks if bundle is in the list of core bundles

func IsOfflineContent

func IsOfflineContent() bool

IsOfflineContent checks that the offline content dir is valid for swupd to consume

func OfflineIsUsable

func OfflineIsUsable(version string, options args.Args) bool

OfflineIsUsable ensures that we have offline content, and that based on our desired version and command line options, that it should be used for the installation.

func SetHostMirror

func SetHostMirror(url string, allowInsecureHTTP bool) (string, error)

SetHostMirror executes the "swupd mirror" to set the Host's mirror

func UnSetHostMirror

func UnSetHostMirror() (string, error)

UnSetHostMirror executes the "swupd mirror" to unset the Host's mirror

Types

type Bundle

type Bundle struct {
	Name string // Name the bundle name or id
	Desc string // Desc is the bundle long description
}

Bundle maps a map name and description with the actual checkbox

func LoadBundleList

func LoadBundleList(model *model.SystemInstall) ([]*Bundle, error)

LoadBundleList loads the bundle definitions

type Message

type Message struct {
	Type            string `json:"type"`
	Msg             string `json:"msg"`
	Section         string `json:"section"`
	Status          int    `json:"status"`
	CurrentStep     int    `json:"currentStep"`
	StepCompletion  int    `json:"stepCompletion"`
	StepDescription string `json:"stepDescription"`
}

Message represents data parsed from a JSON message sent by a swupd command

func (Message) Process

func (m Message) Process(printPrefix, line string)

Process parses the output received from swupd and process it according to its type

type SoftwareUpdater

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

SoftwareUpdater abstracts the swupd executable, environment and operations

func New

func New(rootDir string, options args.Args, model *model.SystemInstall) *SoftwareUpdater

New creates a new instance of SoftwareUpdater with the rootDir properly adjusted

func (*SoftwareUpdater) CleanUpState

func (s *SoftwareUpdater) CleanUpState() error

CleanUpState removes the swupd state content directory

func (*SoftwareUpdater) DisableUpdate

func (s *SoftwareUpdater) DisableUpdate() error

DisableUpdate executes the "systemctl" to disable auto update operation "swupd autoupdate" currently does not --path See Issue https://github.com/clearlinux/swupd-client/issues/527

func (SoftwareUpdater) DownloadBundles

func (s SoftwareUpdater) DownloadBundles(version string, bundles []string) error

DownloadBundles downloads the bundle list to the OfflineContentDir within the installer image

func (*SoftwareUpdater) GetStateDir

func (s *SoftwareUpdater) GetStateDir() string

GetStateDir returns the state directory

func (*SoftwareUpdater) GetTargetMirror

func (s *SoftwareUpdater) GetTargetMirror() (string, error)

GetTargetMirror executes the "swupd mirror" to find the Target's mirror

func (*SoftwareUpdater) OSInstall

func (s *SoftwareUpdater) OSInstall(version, printPrefix string, bundles []string) error

OSInstall runs "swupd os-install" operation with a bundle list

func (*SoftwareUpdater) SetTargetMirror

func (s *SoftwareUpdater) SetTargetMirror(url string) (string, error)

SetTargetMirror executes the "swupd mirror" to set the Target's mirror URL error checking is not done as it is implied the URL was already verified as functional on the currently running Host

Jump to

Keyboard shortcuts

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