util

package
v0.0.0-...-b9fb742 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFile

func AppendFile(path string, contents string) error

AppendFile appends the given contents to a file.

func AppendFileWithPermissions

func AppendFileWithPermissions(path string, contents string, perm os.FileMode) error

func ConfigureFilesystems

func ConfigureFilesystems(ctx context.Context, mountpoint, rootPartition, espPartition string) error

ConfigureFilesystems configures the filesystems on the specified disk

func CopyFile

func CopyFile(src string, dst string) error

CopyFile copies a file from src to dst.

func CopyFileWithPermissions

func CopyFileWithPermissions(src string, dst string, perm os.FileMode) error

CopyFileWithPermissions copies a file from src to dst with the given permissions.

func CreateMountpointAt

func CreateMountpointAt(ctx context.Context, path string) error

CreateMountpoint creates the mountpoint for the bootstrap

func GetFilesystemUUID

func GetFilesystemUUID(ctx context.Context, devicePath string) (string, error)

GetFilesystemUUID returns the UUID of the specified filesystem

func Mount

func Mount(ctx context.Context, device, location string) error

Mount mounts the specified disk at the specified location

func PartitionDisk

func PartitionDisk(ctx context.Context, name string) error

func RemoveMountpointAt

func RemoveMountpointAt(p string)

RemoveMountpointAt removes the specified mountpoint

func TemplateString

func TemplateString(tmpl string, data interface{}) (string, error)

TemplateString renders a template string

func Unmount

func Unmount(ctx context.Context, p string)

Unmount unmounts the filesystem(s) as the specified location

func UnmountRecursive

func UnmountRecursive(p string)

UnmountRecursive recursively unmounts the filesystem(s) as the specified location

func UnpackTarball

func UnpackTarball(ctx context.Context, source, target string) error

UnpackTarball unpacks a tarball to the specified target

func WriteFile

func WriteFile(path string, contents string) error

WriteFile writes a file with the given contents and permissions 0644.

func WriteFileWithPermissions

func WriteFileWithPermissions(path string, contents string, perm os.FileMode) error

WriteFileWithPermissions writes a file with the given contents and permissions.

Types

type LoopDevice

type LoopDevice struct {
	DevicePath string
}

LoopDevice represents a loop device

func (*LoopDevice) Detach

func (l *LoopDevice) Detach()

Detach detaches the loop device

type RawImage

type RawImage struct {
	ImagePath string
	// contains filtered or unexported fields
}

RawImage represents a disk image

func NewRawImage

func NewRawImage(path string, sizeMB int, overwrite bool) *RawImage

NewRawImage initializes a new RawImage struct

func (*RawImage) Alloc

func (i *RawImage) Alloc(ctx context.Context) error

Alloc allocates a new image file

func (*RawImage) Attach

func (i *RawImage) Attach(ctx context.Context) (*LoopDevice, error)

Attach attaches the image to a loop device

func (*RawImage) Convert

func (i *RawImage) Convert(ctx context.Context, output string) error

Convert converts the image

func (*RawImage) Free

func (i *RawImage) Free()

Free removes the raw image

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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