dirs

package
v0.0.0-...-f890545 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: GPL-3.0 Imports: 8 Imported by: 1,013

Documentation

Index

Constants

View Source
const (

	// These are directories which are static inside the core snap and
	// can never be prefixed as they will be always absolute once we
	// are in the snap confinement environment.
	CoreLibExecDir   = "/usr/lib/snapd"
	CoreSnapMountDir = "/snap"

	// UserHomeSnapDir is the directory with snap data inside user's home
	UserHomeSnapDir = "snap"

	// HiddenSnapDataHomeDir is an experimental hidden directory for snap data
	HiddenSnapDataHomeDir = ".snap/data"

	// ExposedSnapHomeDir is the directory where snaps should place user-facing
	// data after ~/snap has been migrated to ~/.snap
	ExposedSnapHomeDir = "Snap"

	// LocalInstallBlobTempPrefix is used by local install code:
	// * in daemon to spool the snap file to <SnapBlobDir>/<LocalInstallBlobTempPrefix>*
	// * in snapstate to auto-cleans them up using the same prefix
	LocalInstallBlobTempPrefix = ".local-install-"
)

Variables

View Source
var (
	GlobalRootDir string = "/"

	RunDir string

	SnapMountDir string

	DistroLibExecDir string

	SnapBlobDir string
	SnapDataDir string

	SnapDownloadCacheDir string
	SnapAppArmorDir      string
	SnapSeccompBase      string
	SnapSeccompDir       string
	SnapMountPolicyDir   string
	SnapCgroupPolicyDir  string
	SnapUdevRulesDir     string
	SnapKModModulesDir   string
	SnapKModModprobeDir  string
	LocaleDir            string
	SnapdSocket          string
	SnapSocket           string
	SnapRunDir           string
	SnapRunNsDir         string
	SnapRunLockDir       string
	SnapBootstrapRunDir  string
	SnapVoidDir          string

	SnapdMaintenanceFile string

	SnapdStoreSSLCertsDir string

	SnapSeedDir   string
	SnapDeviceDir string

	SnapAssertsDBDir      string
	SnapCookieDir         string
	SnapTrustedAccountKey string
	SnapAssertsSpoolDir   string
	SnapSeqDir            string

	SnapStateFile     string
	SnapStateLockFile string
	SnapSystemKeyFile string

	SnapRepairConfigFile string
	SnapRepairDir        string
	SnapRepairStateFile  string
	SnapRepairRunDir     string
	SnapRepairAssertsDir string
	SnapRunRepairDir     string

	SnapRollbackDir string

	SnapCacheDir        string
	SnapNamesFile       string
	SnapSectionsFile    string
	SnapCommandsDB      string
	SnapAuxStoreInfoDir string

	SnapBinariesDir        string
	SnapServicesDir        string
	SnapRuntimeServicesDir string
	SnapUserServicesDir    string
	SnapSystemdConfDir     string
	SnapDesktopFilesDir    string
	SnapDesktopIconsDir    string
	SnapPolkitPolicyDir    string
	SnapSystemdDir         string
	SnapSystemdRunDir      string

	SnapDBusSessionPolicyDir   string
	SnapDBusSystemPolicyDir    string
	SnapDBusSessionServicesDir string
	SnapDBusSystemServicesDir  string

	SnapModeenvFile   string
	SnapBootAssetsDir string
	SnapFDEDir        string
	SnapSaveDir       string
	SnapDeviceSaveDir string
	SnapDataSaveDir   string

	CloudMetaDataFile     string
	CloudInstanceDataFile string

	ClassicDir string

	XdgRuntimeDirBase string
	XdgRuntimeDirGlob string

	CompletionHelperInCore string
	BashCompletionScript   string
	LegacyCompletersDir    string
	CompletersDir          string

	SystemFontsDir            string
	SystemLocalFontsDir       string
	SystemFontconfigCacheDirs []string

	SnapshotsDir string

	SysfsDir string

	FeaturesDir string
)

the various file paths

Functions

func AddRootDirCallback

func AddRootDirCallback(c func(string))

AddRootDirCallback registers a callback for whenever the global root directory (set by SetRootDir) is changed to enable updates to variables in other packages that depend on its location.

func CompleteShPath

func CompleteShPath(base string) string

func DataHomeGlobs

func DataHomeGlobs(opts *SnapDirOptions) []string

DataHomeGlobs returns a slice of globbing expressions for the snap directories in use.

func FeaturesDirUnder

func FeaturesDirUnder(rootdir string) string

FeaturesDirUnder returns the path to the features dir under rootdir.

func IsCompleteShSymlink(compPath string) bool

func SetRootDir

func SetRootDir(rootdir string)

SetRootDir allows settings a new global root directory, this is useful for e.g. chroot operations

func SetSnapHomeDirs

func SetSnapHomeDirs(homedirs string) []string

SetSnapHomeDirs sets SnapHomeDirs to the user defined values and appends /home if needed. homedirs must be a comma separated list of paths to home directories. If homedirs is empty, SnapHomeDirs will be a slice of length 1 containing "/home". Also generates the data directory globbing expressions for each user. Expected to be run by configstate.Init, returns a slice of home directories.

func SnapBlobDirUnder

func SnapBlobDirUnder(rootdir string) string

SnapBlobDirUnder returns the path to the snap blob dir under rootdir.

func SnapBootAssetsDirUnder

func SnapBootAssetsDirUnder(rootdir string) string

SnapBootAssetsDirUnder returns the path to boot assets directory under a rootdir.

func SnapDeviceDirUnder

func SnapDeviceDirUnder(rootdir string) string

SnapDeviceDirUnder returns the path to device directory under rootdir.

func SnapFDEDirUnder

func SnapFDEDirUnder(rootdir string) string

SnapFDEDirUnder returns the path to full disk encryption state directory under rootdir.

func SnapFDEDirUnderSave

func SnapFDEDirUnderSave(savedir string) string

SnapFDEDirUnderSave returns the path to full disk encryption state directory inside the given save tree dir.

func SnapHomeDirs

func SnapHomeDirs() []string

SnapHomeDirs returns a slice of the currently configured home directories.

func SnapKernelDriversTreesDirUnder

func SnapKernelDriversTreesDirUnder(rootdir string) string

SnapKernelTreesDirUnder returns the path to the snap kernel drivers trees dir under rootdir.

func SnapModeenvFileUnder

func SnapModeenvFileUnder(rootdir string) string

SnapModeenvFileUnder returns the path to the modeenv file under rootdir.

func SnapRepairConfigFileUnder

func SnapRepairConfigFileUnder(rootdir string) string

SnapSaveDirUnder returns the path to device save directory under rootdir.

func SnapRuntimeServicesDirUnder

func SnapRuntimeServicesDirUnder(rootdir string) string

func SnapSaveDirUnder

func SnapSaveDirUnder(rootdir string) string

SnapSaveDirUnder returns the path to device save directory under rootdir.

func SnapSeedDirUnder

func SnapSeedDirUnder(rootdir string) string

SnapSeedDirUnder returns the path to the snap seed dir under rootdir.

func SnapServicesDirUnder

func SnapServicesDirUnder(rootdir string) string

SnapServicesDirUnder returns the path to the systemd services conf dir under rootdir.

func SnapStateFileUnder

func SnapStateFileUnder(rootdir string) string

SnapStateFileUnder returns the path to snapd state file under rootdir.

func SnapStateLockFileUnder

func SnapStateLockFileUnder(rootdir string) string

SnapStateLockFileUnder returns the path to snapd state lock file under rootdir.

func SnapSystemParamsUnder

func SnapSystemParamsUnder(rootdir string) string

SnapSystemParamsUnder returns the path to the system-params file under rootdir.

func SnapSystemdConfDirUnder

func SnapSystemdConfDirUnder(rootdir string) string

SnapSystemdConfDirUnder returns the path to the systemd conf dir under rootdir.

func SnapSystemdDirUnder

func SnapSystemdDirUnder(rootdir string) string

SnapSystemdDirUnder returns the path to the systemd conf dir under rootdir.

func SnapdStateDir

func SnapdStateDir(rootdir string) string

SnapdStateDir returns the path to /var/lib/snapd dir under rootdir.

func StripRootDir

func StripRootDir(dir string) string

StripRootDir strips the custom global root directory from the specified argument.

func SupportsClassicConfinement

func SupportsClassicConfinement() bool

SupportsClassicConfinement returns true if the current directory layout supports classic confinement.

Types

type SnapDirOptions

type SnapDirOptions struct {
	// HiddenSnapDataDir determines if the snaps' data is in ~/.snap/data instead
	// of ~/snap
	HiddenSnapDataDir bool

	// MigratedToExposedHome determines if the snap's directory in ~/Snap has been
	// initialized with the contents of the snap's previous home (i.e., the
	// revisioned data directory).
	MigratedToExposedHome bool
}

Jump to

Keyboard shortcuts

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