fs

package
v0.0.0-...-6054725 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupFile

func LookupFile(targetRoot string, path string) (string, error)

LookupFile look up file path in target root directory

Types

type Manifest

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

Manifest represent the filesystem.

func NewManifest

func NewManifest(targetRoot string) *Manifest

NewManifest init

func (*Manifest) AddArgument

func (m *Manifest) AddArgument(arg string)

AddArgument add commandline arguments to user program

func (*Manifest) AddDebugFlag

func (m *Manifest) AddDebugFlag(name string, value rune)

AddDebugFlag enables debug flags

func (*Manifest) AddDirectory

func (m *Manifest) AddDirectory(dir string, workDir string, opath string, insidepkg bool) error

AddDirectory adds all files in dir to image

If insidepkg is not set then strip path prefix opath is currently passed in only because of this chdir call which gets cleaned up afterwards; should look at removing that in the future.

func (*Manifest) AddEnvironmentVariable

func (m *Manifest) AddEnvironmentVariable(name string, value string)

AddEnvironmentVariable adds environment variables

func (*Manifest) AddFile

func (m *Manifest) AddFile(filepath string, hostpath string) error

AddFile to add a file to manifest

func (*Manifest) AddFileTo

func (m *Manifest) AddFileTo(dir map[string]interface{}, filepath string, hostpath string) error

AddFileTo adds a file to a given directory

func (*Manifest) AddKernel

func (m *Manifest) AddKernel(path string)

AddKernel the kernel to use

func (*Manifest) AddKlibs

func (m *Manifest) AddKlibs(klibs []string)

AddKlibs append klibs to manifest file if they don't exist

func (m *Manifest) AddLink(filepath string, hostpath string) error

AddLink to add a file to manifest

func (*Manifest) AddMount

func (m *Manifest) AddMount(label, path string)

AddMount adds mount

func (*Manifest) AddNetworkConfig

func (m *Manifest) AddNetworkConfig(networkConfig *ManifestNetworkConfig)

AddNetworkConfig adds network configuration

func (*Manifest) AddNoTrace

func (m *Manifest) AddNoTrace(name string)

AddNoTrace enables debug flags

func (*Manifest) AddPassthrough

func (m *Manifest) AddPassthrough(key string, value interface{})

AddPassthrough to add key, value directly to manifest

func (*Manifest) AddRelativeDirectory

func (m *Manifest) AddRelativeDirectory(src string) error

AddRelativeDirectory adds all files in dir to image

func (*Manifest) AddUserProgram

func (m *Manifest) AddUserProgram(imgpath string) (err error)

AddUserProgram adds user program

func (*Manifest) FileExists

func (m *Manifest) FileExists(filepath string) bool

FileExists checks if file is present at path in manifest

func (*Manifest) MkdirPath

func (m *Manifest) MkdirPath(path string)

MkdirPath is mkDirPath() using root directory as parent

func (*Manifest) SetKlibDir

func (m *Manifest) SetKlibDir(dir string)

SetKlibDir sets the host directory where kernel libs are located

func (*Manifest) SetProgram

func (m *Manifest) SetProgram(program string)

SetProgram sets user program

type ManifestNetworkConfig

type ManifestNetworkConfig struct {
	IP      string
	IPv6    string
	Gateway string
	NetMask string
}

ManifestNetworkConfig has network configuration to set static IP

type MkfsCommand

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

MkfsCommand wraps mkfs calls

func NewMkfsCommand

func NewMkfsCommand(m *Manifest, partitions bool) *MkfsCommand

NewMkfsCommand returns an instance of MkfsCommand

func (*MkfsCommand) Execute

func (m *MkfsCommand) Execute() error

Execute runs mkfs command

func (*MkfsCommand) GetUUID

func (m *MkfsCommand) GetUUID() string

GetUUID returns the uuid of file system built

func (*MkfsCommand) SetBoot

func (m *MkfsCommand) SetBoot(boot string)

SetBoot adds argument that sets file system boot

func (*MkfsCommand) SetFileSystemPath

func (m *MkfsCommand) SetFileSystemPath(fsPath string)

SetFileSystemPath add argument that sets file system path

func (*MkfsCommand) SetFileSystemSize

func (m *MkfsCommand) SetFileSystemSize(size string) error

SetFileSystemSize adds argument that sets file system size

func (*MkfsCommand) SetLabel

func (m *MkfsCommand) SetLabel(label string)

SetLabel add label argument that sets file system label

func (*MkfsCommand) SetOldEncoding

func (m *MkfsCommand) SetOldEncoding()

SetOldEncoding forces use of TFS version 4

func (*MkfsCommand) SetUefi

func (m *MkfsCommand) SetUefi(uefi string)

SetUefi sets path of UEFI bootloader

type Reader

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

Reader allows reading filesystem contents from an image

func NewReader

func NewReader(imagePath string) (*Reader, error)

NewReader returns an instance of Reader

func (*Reader) Close

func (r *Reader) Close() error

Close closes the image file

func (*Reader) CopyFile

func (r *Reader) CopyFile(src, dest string, dereference bool) error

CopyFile copies a file from the image to the local filesystem

func (*Reader) GetLabel

func (r *Reader) GetLabel() string

GetLabel of image file system

func (*Reader) GetUUID

func (r *Reader) GetUUID() string

GetUUID of image file system

func (*Reader) ListEnv

func (r *Reader) ListEnv() map[string]string

ListEnv returns the set of environment variables in the image

func (*Reader) ReadDir

func (r *Reader) ReadDir(path string) ([]os.FileInfo, error)

ReadDir returns the contents of a directory in the image

func (r *Reader) ReadLink(path string) (string, error)

ReadLink returns the target of a symbolic link in the image

func (*Reader) Stat

func (r *Reader) Stat(path string) (os.FileInfo, error)

Stat retrieves information for a file in the image

Jump to

Keyboard shortcuts

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