debos: github.com/go-debos/debos Index | Files | Directories

package debos

import "github.com/go-debos/debos"

Index

Package Files

action.go archiver.go commands.go debug.go filesystem.go net.go os.go

Constants

const (
    CHROOT_METHOD_NONE   = iota // No chroot in use
    CHROOT_METHOD_NSPAWN        // use nspawn to create the chroot environment
    CHROOT_METHOD_CHROOT        // use chroot to create the chroot environment
)

func CleanPath Uses

func CleanPath(path string) string

func CleanPathAt Uses

func CleanPathAt(path, at string) string

func CopyFile Uses

func CopyFile(src, dst string, mode os.FileMode) error

func CopyTree Uses

func CopyTree(sourcetree, desttree string) error

func DebugShell Uses

func DebugShell(context DebosContext)

DebugShell function launches an interactive shell for debug and problems investigation.

func DownloadHttpUrl Uses

func DownloadHttpUrl(url, filename string) error

Function for downloading single file object with http(s) protocol

func RealPath Uses

func RealPath(path string) (string, error)

func RestrictedPath Uses

func RestrictedPath(prefix, dest string) (string, error)

type Action Uses

type Action interface {
    /* FIXME verify should probably be prepare or somesuch */
    Verify(context *DebosContext) error
    PreMachine(context *DebosContext, m *fakemachine.Machine, args *[]string) error
    PreNoMachine(context *DebosContext) error
    Run(context *DebosContext) error
    // Cleanup() method gets called only if the Run for an action
    // was started and in the same machine (host or fake) as Run has run
    Cleanup(context *DebosContext) error
    PostMachine(context *DebosContext) error
    // PostMachineCleanup() gets called for all actions if Pre*Machine() method
    // has run for Action. This method is always executed on the host with user's permissions.
    PostMachineCleanup(context *DebosContext) error
    String() string
}

type Archive Uses

type Archive struct {
    Archiver
}

func NewArchive Uses

func NewArchive(file string, arcType ...ArchiveType) (Archive, error)

NewArchive associate correct structure and methods according to archive type. If ArchiveType is omitted -- trying to guess the type. Return ArchiveType or nil in case of error.

type ArchiveBase Uses

type ArchiveBase struct {
    // contains filtered or unexported fields
}

func (*ArchiveBase) AddOption Uses

func (arc *ArchiveBase) AddOption(key, value interface{}) error

func (*ArchiveBase) RelaxedUnpack Uses

func (arc *ArchiveBase) RelaxedUnpack(destination string) error

RelaxedUnpack unpack archive in relaxed mode allowing to ignore or avoid minor issues with unpacker tool or framework.

func (*ArchiveBase) Type Uses

func (arc *ArchiveBase) Type() ArchiveType

func (*ArchiveBase) Unpack Uses

func (arc *ArchiveBase) Unpack(destination string) error

Unpack archive as is

type ArchiveDeb Uses

type ArchiveDeb struct {
    ArchiveBase
}

func (*ArchiveDeb) RelaxedUnpack Uses

func (deb *ArchiveDeb) RelaxedUnpack(destination string) error

func (*ArchiveDeb) Unpack Uses

func (deb *ArchiveDeb) Unpack(destination string) error

type ArchiveTar Uses

type ArchiveTar struct {
    ArchiveBase
}

func (*ArchiveTar) AddOption Uses

func (tar *ArchiveTar) AddOption(key, value interface{}) error

func (*ArchiveTar) RelaxedUnpack Uses

func (tar *ArchiveTar) RelaxedUnpack(destination string) error

func (*ArchiveTar) Unpack Uses

func (tar *ArchiveTar) Unpack(destination string) error

type ArchiveType Uses

type ArchiveType int
const (
    Tar ArchiveType
    Zip
    Deb
)

Supported types

type ArchiveZip Uses

type ArchiveZip struct {
    ArchiveBase
}

func (*ArchiveZip) RelaxedUnpack Uses

func (zip *ArchiveZip) RelaxedUnpack(destination string) error

func (*ArchiveZip) Unpack Uses

func (zip *ArchiveZip) Unpack(destination string) error

type Archiver Uses

type Archiver interface {
    Type() ArchiveType
    AddOption(key, value interface{}) error
    Unpacker
}

type BaseAction Uses

type BaseAction struct {
    Action      string
    Description string
}

func (*BaseAction) Cleanup Uses

func (b *BaseAction) Cleanup(context *DebosContext) error

func (*BaseAction) LogStart Uses

func (b *BaseAction) LogStart()

func (*BaseAction) PostMachine Uses

func (b *BaseAction) PostMachine(context *DebosContext) error

func (*BaseAction) PostMachineCleanup Uses

func (b *BaseAction) PostMachineCleanup(context *DebosContext) error

func (*BaseAction) PreMachine Uses

func (b *BaseAction) PreMachine(context *DebosContext,
    m *fakemachine.Machine,
    args *[]string) error

func (*BaseAction) PreNoMachine Uses

func (b *BaseAction) PreNoMachine(context *DebosContext) error

func (*BaseAction) Run Uses

func (b *BaseAction) Run(context *DebosContext) error

func (*BaseAction) String Uses

func (b *BaseAction) String() string

func (*BaseAction) Verify Uses

func (b *BaseAction) Verify(context *DebosContext) error

type ChrootEnterMethod Uses

type ChrootEnterMethod int

type Command Uses

type Command struct {
    Architecture string            // Architecture of the chroot, nil if same as host
    Dir          string            // Working dir to run command in
    Chroot       string            // Run in the chroot at path
    ChrootMethod ChrootEnterMethod // Method to enter the chroot
    // contains filtered or unexported fields
}

func NewChrootCommandForContext Uses

func NewChrootCommandForContext(context DebosContext) Command

func (*Command) AddBindMount Uses

func (cmd *Command) AddBindMount(source, target string)

func (*Command) AddEnv Uses

func (cmd *Command) AddEnv(env string)

func (*Command) AddEnvKey Uses

func (cmd *Command) AddEnvKey(key, value string)

func (Command) Run Uses

func (cmd Command) Run(label string, cmdline ...string) error

type CommonContext Uses

type CommonContext struct {
    Scratchdir      string
    Rootdir         string
    Artifactdir     string
    Downloaddir     string
    Image           string
    ImagePartitions []Partition
    ImageMntDir     string
    ImageFSTab      bytes.Buffer // Fstab as per partitioning
    ImageKernelRoot string       // Kernel cmdline root= snippet for the / of the image
    DebugShell      string
    Origins         map[string]string
    State           DebosState
    EnvironVars     map[string]string
    PrintRecipe     bool
    Verbose         bool
}

type DebosContext Uses

type DebosContext struct {
    *CommonContext
    RecipeDir    string
    Architecture string
}

type DebosState Uses

type DebosState int
const (
    Success DebosState = iota
    Failed
)

Represent the current state of Debos

type Partition Uses

type Partition struct {
    Name       string
    DevicePath string
}

Mapping from partition name as configured in the image-partition action to device path for usage by other actions

type ServiceHelper Uses

type ServiceHelper struct {
    Rootdir string
}

func (*ServiceHelper) Allow Uses

func (s *ServiceHelper) Allow() error

Allow() allows to start/stop services on OS level.

func (*ServiceHelper) Deny Uses

func (s *ServiceHelper) Deny() error

Deny() prohibits to start/stop services on OS level.

type ServicesManager Uses

type ServicesManager interface {
    Allow() error
    Deny() error
}

type Unpacker Uses

type Unpacker interface {
    Unpack(destination string) error
    RelaxedUnpack(destination string) error
}

Directories

PathSynopsis
actionsPackage 'actions' implements 'debos' modules used for OS creation.
cmd/debos

Package debos imports 13 packages (graph) and is imported by 4 packages. Updated 2020-09-18. Refresh now. Tools for package owners.