Version: v0.0.0-...-2fb355d Latest Latest

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

Go to latest
Published: Jun 18, 2021 License: GPL-3.0 Imports: 4 Imported by: 0




This section is empty.


This section is empty.


func Flag

func Flag(tr confGetter, feature SnapdFeature) (bool, error)

Flag returns whether the given feature flag is enabled.


type SnapdFeature

type SnapdFeature int

SnapdFeature is a named feature that may be on or off.

const (
	// Layouts controls availability of snap layouts.
	Layouts SnapdFeature = iota
	// ParallelInstances controls availability installing a snap multiple times.
	// Hotplug controls availability of dynamically creating slots based on system hardware.
	// SnapdSnap controls possibility of installing the snapd snap.
	// PerUserMountNamespace controls the persistence of per-user mount namespaces.
	// RefreshAppAwareness controls refresh being aware of running applications.
	// ClassicPreservesXdgRuntimeDir controls $XDG_RUNTIME_DIR in snaps with classic confinement.
	// RobustMountNamespaceUpdates controls how snap-update-ns updates existing mount namespaces.
	// UserDaemons controls availability of user mode service support.
	// DbusActivation controls whether snaps daemons can be activated via D-Bus
	// HiddenSnapFolder moves ~/snap to ~/.snapdata.
	// CheckDiskSpaceRemove controls free disk space check on remove whenever automatic snapshot needs to be created.
	// CheckDiskSpaceInstall controls free disk space check on snap install.
	// CheckDiskSpaceRefresh controls free disk space check on snap refresh.
	// GateAutoRefreshHook enables refresh control from snaps via gate-auto-refresh hook.

	// QuotaGroups enable creating resource quota groups for snaps via the rest API and cli.

func KnownFeatures

func KnownFeatures() []SnapdFeature

KnownFeatures returns the list of all known features.

func (SnapdFeature) ConfigOption

func (f SnapdFeature) ConfigOption() (snapName, confName string)

ConfigOption returns the snap name and configuration option associated with this feature.

func (SnapdFeature) ControlFile

func (f SnapdFeature) ControlFile() string

ControlFile returns the path of the file controlling the exported feature.

Snapd considers the feature enabled if the file is present. The contents of the file are not important.

The function panics for features that are not exported.

func (SnapdFeature) IsEnabled

func (f SnapdFeature) IsEnabled() bool

IsEnabled checks if a given exported snapd feature is enabled.

The function panics for features that are not exported.

func (SnapdFeature) IsEnabledWhenUnset

func (f SnapdFeature) IsEnabledWhenUnset() bool

IsEnabledWhenUnset returns true if a feature is enabled when not set.

A feature may be enabled or disabled with explicit state in snapd. If explicit state is absent the effective value is the implicit default computed by this function.

func (SnapdFeature) IsExported

func (f SnapdFeature) IsExported() bool

IsExported returns true if a feature is copied from snapd state to a feature file.

Certain features are available outside of snapd internal state and visible as control files in a dedicated directory. Such features can be queried for, via IsEnabled, outside of snapd.

func (SnapdFeature) String

func (f SnapdFeature) String() string

String returns the name of a snapd feature. The function panics for bogus feature values.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL