snapdtool

package
v0.0.0-...-2fb355d Latest Latest
Warning

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

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

Documentation

Overview

Package snapdtool exposes version and related information, supports re-execution and inter-tool lookup/execution across all snapd tools.

Index

Constants

This section is empty.

Variables

View Source
var Version = "unknown"

Version will be overwritten at build-time via mkversion.sh

Functions

func CommandFromSystemSnap

func CommandFromSystemSnap(name string, cmdArgs ...string) (*exec.Cmd, error)

CommandFromSystemSnap runs a command from the snapd/core snap using the proper interpreter and library paths.

At the moment it can only run ELF files, expects a standard ld.so interpreter, and can't handle RPATH.

func ExecInSnapdOrCoreSnap

func ExecInSnapdOrCoreSnap()

ExecInSnapdOrCoreSnap makes sure you're executing the binary that ships in the snapd/core snap.

func InternalToolPath

func InternalToolPath(tool string) (string, error)

InternalToolPath returns the path of an internal snapd tool. The tool *must* be located inside the same tree as the current binary.

The return value is either the path of the tool in the current distribution or in the core/snapd snap (or the ubuntu-core snap) if the current binary is ran from that location.

func IsReexecd

func IsReexecd() (bool, error)

IsReexecd returns true when the current process binary is running from a snap.

func MockOsReadlink(f func(string) (string, error)) func()

MockOsReadlink is for use in tests

func MockVersion

func MockVersion(version string) (restore func())

func SnapdVersionFromInfoFile

func SnapdVersionFromInfoFile(infoPath string) (string, error)

SnapdVersionFromInfoFile returns snapd version read for the given info" file, pointed by infoPath. The format of the "info" file is a single line with "VERSION=..." in it. The file is produced by mkversion.sh and normally installed along snapd binary in /usr/lib/snapd.

Types

This section is empty.

Jump to

Keyboard shortcuts

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