Documentation ¶
Index ¶
- func AddImplicitSlots(snapInfo *Info)
- func AppSecurityTag(snapName, appName string) string
- func GuessAppsForBroken(info *Info) map[string]*AppInfo
- func HookSecurityTag(snapName, hookName string) string
- func IsHookSupported(hookName string) bool
- func MountDir(name string, revision Revision) string
- func NoneSecurityTag(snapName, uniqueName string) string
- func SecurityTag(snapName string) string
- func SplitSnapApp(snapApp string) (snap, app string)
- func Validate(info *Info) error
- func ValidateApp(app *AppInfo) error
- func ValidateEpoch(epoch string) error
- func ValidateHook(hook *HookInfo) error
- func ValidateName(name string) error
- type AppInfo
- func (app *AppInfo) Env() []string
- func (app *AppInfo) LauncherCommand() string
- func (app *AppInfo) LauncherPostStopCommand() string
- func (app *AppInfo) LauncherStopCommand() string
- func (app *AppInfo) SecurityTag() string
- func (app *AppInfo) ServiceFile() string
- func (app *AppInfo) ServiceSocketFile() string
- func (app *AppInfo) WrapperPath() string
- type ConfinementType
- type Container
- type Content
- type DeltaInfo
- type DownloadInfo
- type GadgetInfo
- type HookInfo
- type HookType
- type Info
- func (s *Info) CommonDataDir() string
- func (s *Info) CommonDataHomeDir() string
- func (s *Info) DataDir() string
- func (s *Info) DataHomeDir() string
- func (s *Info) Description() string
- func (s *Info) HooksDir() string
- func (s *Info) MountDir() string
- func (s *Info) MountFile() string
- func (s *Info) Name() string
- func (s *Info) NeedsDevMode() bool
- func (s *Info) Summary() string
- func (s *Info) UserCommonDataDir(home string) string
- func (s *Info) UserDataDir(home string) string
- type NotFoundError
- type PlaceInfo
- type PlugInfo
- type Revision
- func (r Revision) Local() bool
- func (r Revision) MarshalJSON() ([]byte, error)
- func (r Revision) MarshalYAML() (interface{}, error)
- func (r Revision) Store() bool
- func (r Revision) String() string
- func (r *Revision) UnmarshalJSON(data []byte) error
- func (r *Revision) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (r Revision) Unset() bool
- type ScreenshotInfo
- type Seed
- type SeedSnap
- type SideInfo
- type SlotInfo
- type Structure
- type Type
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddImplicitSlots ¶
func AddImplicitSlots(snapInfo *Info)
AddImplicitSlots adds implicitly defined slots to a given snap.
Only the OS snap has implicit slots.
It is assumed that slots have names matching the interface name. Existing slots are not changed, only missing slots are added.
func AppSecurityTag ¶
AppSecurityTag returns the application-specific security tag.
func GuessAppsForBroken ¶
func HookSecurityTag ¶
HookSecurityTag returns the hook-specific security tag.
func IsHookSupported ¶
IsHookSupported returns true if the given hook name matches one of the supported hooks.
func MountDir ¶
MountDir returns the base directory where it gets mounted of the snap with the given name and revision.
func NoneSecurityTag ¶
NoneSecurityTag returns the security tag for interfaces that are not associated to an app or hook in the snap.
func SecurityTag ¶
SecurityTag returns the snap-specific security tag.
func SplitSnapApp ¶
SplitSnapApp will split a string of the form `snap.app` into the `snap` and the `app` part. It also deals with the special case of snapName == appName.
func ValidateApp ¶
ValidateApp verifies the content in the app info.
func ValidateEpoch ¶
ValidateEpoch checks if a string can be used as a snap epoch.
func ValidateHook ¶
ValidateHook validates the content of the given HookInfo
func ValidateName ¶
ValidateName checks if a string can be used as a snap name.
Types ¶
type AppInfo ¶
type AppInfo struct { Snap *Info Name string Command string Daemon string StopTimeout timeout.Timeout StopCommand string PostStopCommand string RestartCond systemd.RestartCondition Socket bool SocketMode string ListenStream string // TODO: this should go away once we have more plumbing and can change // things vs refactor // https://github.com/snapcore/snapd/pull/794#discussion_r58688496 BusName string Plugs map[string]*PlugInfo Slots map[string]*SlotInfo Environment map[string]string }
AppInfo provides information about a app.
func (*AppInfo) LauncherCommand ¶
LauncherCommand returns the launcher command line to use when invoking the app binary.
func (*AppInfo) LauncherPostStopCommand ¶
LauncherPostStopCommand returns the launcher command line to use when invoking the app post-stop command binary.
func (*AppInfo) LauncherStopCommand ¶
LauncherStopCommand returns the launcher command line to use when invoking the app stop command binary.
func (*AppInfo) SecurityTag ¶
SecurityTag returns application-specific security tag.
Security tags are used by various security subsystems as "profile names" and sometimes also as a part of the file name.
func (*AppInfo) ServiceFile ¶
ServiceFile returns the systemd service file path for the daemon app.
func (*AppInfo) ServiceSocketFile ¶
ServiceSocketFile returns the systemd socket file path for the daemon app.
func (*AppInfo) WrapperPath ¶
WrapperPath returns the path to wrapper invoking the app binary.
type ConfinementType ¶
type ConfinementType string
ConfinementType represents the kind of confinement supported by the snap (devmode only, or strict confinement)
const ( DevmodeConfinement ConfinementType = "devmode" StrictConfinement ConfinementType = "strict" )
The various confinement types we support
func (*ConfinementType) UnmarshalJSON ¶
func (confinementType *ConfinementType) UnmarshalJSON(data []byte) error
UnmarshalJSON sets *confinementType to a copy of data, assuming validation passes
func (*ConfinementType) UnmarshalYAML ¶
func (confinementType *ConfinementType) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML so ConfinementType implements yaml's Unmarshaler interface
type Container ¶
type Container interface { // ReadFile returns the content of a single file from the snap. ReadFile(relative string) ([]byte, error) // ListDir returns the content of a single directory inside the snap. ListDir(path string) ([]string, error) // Install copies the snap file to targetPath (and possibly unpacks it to mountDir) Install(targetPath, mountDir string) error // Unpack unpacks the src parts to the dst directory Unpack(src, dst string) error }
Container is the interface to interact with the low-level snap files
type DeltaInfo ¶
type DeltaInfo struct { FromRevision int `json:"from-revision,omitempty"` ToRevision int `json:"to-revision,omitempty"` Format string `json:"format,omitempty"` AnonDownloadURL string `json:"anon-download-url,omitempty"` DownloadURL string `json:"download-url,omitempty"` Size int64 `json:"size,omitempty"` Sha3_384 string `json:"sha3-384,omitempty"` }
DeltaInfo contains the information to download a delta from one revision to another.
type DownloadInfo ¶
type DownloadInfo struct { AnonDownloadURL string `json:"anon-download-url,omitempty"` DownloadURL string `json:"download-url,omitempty"` Size int64 `json:"size,omitempty"` Sha3_384 string `json:"sha3-384,omitempty"` Deltas []DeltaInfo `json:"deltas,omitempty"` }
DownloadInfo contains the information to download a snap. It can be marshalled.
type GadgetInfo ¶
func ReadGadgetInfo ¶
func ReadGadgetInfo(info *Info) (*GadgetInfo, error)
type HookInfo ¶
HookInfo provides information about a hook.
func (*HookInfo) SecurityTag ¶
SecurityTag returns the hook-specific security tag.
Security tags are used by various security subsystems as "profile names" and sometimes also as a part of the file name.
type HookType ¶
type HookType struct {
// contains filtered or unexported fields
}
HookType represents a pattern of supported hook names.
type Info ¶
type Info struct { SuggestedName string Version string Type Type Architectures []string Assumes []string OriginalSummary string OriginalDescription string Environment map[string]string LicenseAgreement string LicenseVersion string Epoch string Confinement ConfinementType Apps map[string]*AppInfo Hooks map[string]*HookInfo Plugs map[string]*PlugInfo Slots map[string]*SlotInfo // The information in all the remaining fields is not sourced from the snap blob itself. SideInfo // Broken marks if set whether the snap is broken and the reason. Broken string // The information in these fields is ephemeral, available only from the store. DownloadInfo IconURL string Prices map[string]float64 `yaml:"prices,omitempty" json:"prices,omitempty"` MustBuy bool Screenshots []ScreenshotInfo }
Info provides information about snaps.
func InfoFromSnapYaml ¶
InfoFromSnapYaml creates a new info based on the given snap.yaml data
func ReadInfo ¶
ReadInfo reads the snap information for the installed snap with the given name and given side-info.
func ReadInfoFromSnapFile ¶
ReadInfoFromSnapFile reads the snap information from the given File and completes it with the given side-info if this is not nil.
func (*Info) CommonDataDir ¶
CommonDataDir returns the data directory common across revisions of the snap.
func (*Info) CommonDataHomeDir ¶
CommonDataHomeDir returns the per user data directory common across revisions of the snap.
func (*Info) DataHomeDir ¶
DataHomeDir returns the per user data directory of the snap.
func (*Info) Description ¶
Description returns the blessed description for the snap.
func (*Info) MountFile ¶
MountFile returns the path where the snap file that is mounted is installed.
func (*Info) NeedsDevMode ¶
NeedsDevMode retursn whether the snap needs devmode.
func (*Info) UserCommonDataDir ¶
UserCommonDataDir returns the user-specific data directory common across revision of the snap.
func (*Info) UserDataDir ¶
UserDataDir returns the user-specific data directory of the snap.
type NotFoundError ¶
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type PlaceInfo ¶
type PlaceInfo interface { // Name returns the name of the snap. Name() string // MountDir returns the base directory of the snap. MountDir() string // MountFile returns the path where the snap file that is mounted is installed. MountFile() string // HooksDir returns the directory containing the snap's hooks. HooksDir() string // DataDir returns the data directory of the snap. DataDir() string // CommonDataDir returns the data directory common across revisions of the snap. CommonDataDir() string // DataHomeDir returns the per user data directory of the snap. DataHomeDir() string // CommonDataHomeDir returns the per user data directory common across revisions of the snap. CommonDataHomeDir() string }
PlaceInfo offers all the information about where a snap and its data are located and exposed in the filesystem.
func MinimalPlaceInfo ¶
MinimalPlaceInfo returns a PlaceInfo with just the location information for a snap of the given name and revision.
type PlugInfo ¶
type PlugInfo struct { Snap *Info Name string Interface string Attrs map[string]interface{} Label string Apps map[string]*AppInfo Hooks map[string]*HookInfo }
PlugInfo provides information about a plug.
type Revision ¶
type Revision struct {
N int
}
func ParseRevision ¶
ParseRevisions returns the representation in r as a revision. See R for a function more suitable for hardcoded revisions.
func R ¶
func R(r interface{}) Revision
R returns a Revision given an int or a string. Providing an invalid revision type or value causes a runtime panic. See ParseRevision for a polite function that does not panic.
func (Revision) MarshalJSON ¶
func (Revision) MarshalYAML ¶
func (*Revision) UnmarshalJSON ¶
func (*Revision) UnmarshalYAML ¶
type ScreenshotInfo ¶
ScreenshotInfo provides information about a screenshot.
type SeedSnap ¶
type SeedSnap struct { Name string `yaml:"name"` // cross-reference/audit SnapID string `yaml:"snap-id,omitempty"` // bits that are orthongonal/not in assertions Channel string `yaml:"channel,omitempty"` DevMode bool `yaml:"devmode,omitempty"` Private bool `yaml:"private,omitempty"` // no assertions are available in the seed for this snap Unasserted bool `yaml:"unasserted,omitempty"` File string `yaml:"file"` }
SeedSnap points to a snap in the seed to install, together with assertions (or alone if unasserted is true) it will be used to drive the installation and ultimately set SideInfo/SnapState for it.
type SideInfo ¶
type SideInfo struct { RealName string `yaml:"name,omitempty" json:"name,omitempty"` SnapID string `yaml:"snap-id" json:"snap-id"` Revision Revision `yaml:"revision" json:"revision"` Channel string `yaml:"channel,omitempty" json:"channel,omitempty"` DeveloperID string `yaml:"developer-id,omitempty" json:"developer-id,omitempty"` Developer string `yaml:"developer,omitempty" json:"developer,omitempty"` // XXX: obsolete, will be retired after full backfilling of DeveloperID EditedSummary string `yaml:"summary,omitempty" json:"summary,omitempty"` EditedDescription string `yaml:"description,omitempty" json:"description,omitempty"` Private bool `yaml:"private,omitempty" json:"private,omitempty"` }
SideInfo holds snap metadata that is crucial for the tracking of snaps and for the working of the system offline and which is not included in snap.yaml or for which the store is the canonical source overriding snap.yaml content.
It can be marshalled and will be stored in the system state for each currently installed snap revision so it needs to be evolved carefully.
Information that can be taken directly from snap.yaml or that comes from the store but is not required for working offline should not end up in SideInfo.
type SlotInfo ¶
type SlotInfo struct { Snap *Info Name string Interface string Attrs map[string]interface{} Label string Apps map[string]*AppInfo }
SlotInfo provides information about a slot.
type Type ¶
type Type string
Type represents the kind of snap (app, core, gadget, os, kernel)
const ( TypeApp Type = "app" TypeGadget Type = "gadget" TypeOS Type = "os" TypeKernel Type = "kernel" )
The various types of snap parts we support
func (*Type) UnmarshalJSON ¶
UnmarshalJSON sets *m to a copy of data.
func (*Type) UnmarshalYAML ¶
UnmarshalYAML so ConfinementType implements yaml's Unmarshaler interface