Documentation
¶
Index ¶
- func ArrangeFilesystem(paths *Paths, cfg *config.Config) error
- func BaseConfigPath(homeDir string) string
- func ConfigDir(homeDir string) string
- func CreateEnvDir(dropHome string, envId string) error
- func CwdToEnvId() (string, error)
- func DropHome(homeDir string) (string, error)
- func EnvConfigPath(homeDir, envId string) string
- func EnvPath(dropHome, envId string) string
- func IsEnvIdValid(envId string) bool
- func LsEnvs(dropHome string) ([]string, error)
- func RmEnv(homeDir, dropHome string, envId string) error
- func WriteEtcFiles(paths *Paths) error
- type Paths
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrangeFilesystem ¶
ArrangeFilesystem sets up the jail filesystem hierarchy.
func BaseConfigPath ¶
BaseConfigPath returns path to a base Drop config file which environment specific config files extend by default. If DROP_HOME is set, DROP_HOME/config/base.toml is returned, otherwise XDG specification is followed: the base config is in (XDG_CONFIG_HOME or "~/.config")/drop/base.toml
func CreateEnvDir ¶
func CwdToEnvId ¶
func DropHome ¶
DropHome returns the base directory for Drop data (environment dirs, internal files, such as mount points). If DROP_HOME is set, it is used directly, otherwise XDG specification is followed: (XDG_DATA_HOME or "~/.local/share")/drop/ is returned
func EnvConfigPath ¶
func IsEnvIdValid ¶
func WriteEtcFiles ¶
WriteEtcFiles writes configuration files needed in the jail's /etc directory.
Types ¶
type Paths ¶
type Paths struct {
// Cwd is the directory where Drop was started.
Cwd string
// DropHome is the top-level directory where Drop files are stored
// (e.g. /home/alice/.local/share/drop).
DropHome string
// Env is the entry point for all paths specific to the current
// environment. For example, if envId is 'project-foo', Env is
// /home/alice/.local/share/drop/envs/project-foo.
Env string
// FsRoot is where the root filesystem is assembled before chroot.
FsRoot string
// HostHome is the user's home directory on the host system
// (e.g. /home/alice).
HostHome string
// Home is the directory mounted as the home directory in the jail
// (e.g. /home/alice/.local/share/drop/envs/project-foo/home).
Home string
// Etc is the directory mounted as read-only overlay over /etc in the jail
// (e.g. /home/alice/.local/share/drop/envs/project-foo/etc).
Etc string
// Var is the directory mounted as /var in the jail. The original
// /var is hidden
// (e.g. /home/alice/.local/share/drop/envs/project-foo/var).
Var string
// Tmp is the directory mounted as /tmp in the jail. It is placed as a
// subdir of the host $TMPDIR to allow standard cleanup mechanisms.
Tmp string
// Run holds temporary files and dirs for the current jail instance.
// It can be safely remove once the jailed process terminates.
Run string
// EmptyDir is an empty directory used to hide directories in the jail.
EmptyDir string
// EmptyFile is an empty file used to hide files in the jail.
EmptyFile string
}
Paths contains filesystem paths used to setup the jail.