fs

package
v0.0.0-...-9200169 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package fs exports functionality related to all of the cos-customizer state stored on the file system.

Index

Constants

View Source
const (
	// ScratchDir is used for temp files and the like.
	ScratchDir = "/tmp"
)

Variables

This section is empty.

Functions

func ArchiveHasObject

func ArchiveHasObject(archive string, path string) (bool, error)

ArchiveHasObject determines if the given tar archive contains the given object.

func CopyRecursive

func CopyRecursive(src string, dst string) error

CopyRecursive calls 'cp -r <src> <dst>'.

func CreateBuildContextArchive

func CreateBuildContextArchive(src, dst string) error

CreateBuildContextArchive creates a tar archive of the given build context.

func ExtractFile

func ExtractFile(inputFile, destDir string) error

ExtractFile decompresses the tar file at inputFile to destDir.

func GzipFile

func GzipFile(inPath, outPath string) (err error)

GzipFile compresses the file at the input path and saves the result at the output path.

func ReadObjectFromArchive

func ReadObjectFromArchive(archive string, path string) ([]byte, error)

ReadObjectFromArchive reads the given object in the given tar archive.

func TarDir

func TarDir(root, dst string) error

TarDir compresses the directory at root to dst.

func TarFile

func TarFile(src, dst string) error

TarFile compresses the file at src to dst.

Types

type Files

type Files struct {

	// UserBuildContextArchive points to the tar archive of the user build context.
	// The user build context contains user provided scripts and files that users can use during preloading.
	UserBuildContextArchive string
	// SourceImageConfig points to the source image configuration.
	SourceImageConfig string
	// BuildConfig points to the image build process configuration.
	BuildConfig string
	// ProvConfig points to the provisioner configuration that runs on the preload
	// VM.
	ProvConfig string
	// DaisyWorkflow points to the Daisy workflow to template and use for preloading.
	DaisyWorkflow string
	// DaisyBin points to the Daisy binary.
	DaisyBin string
	// CIDataImg points to the vfat image that delivers the provisioner and its
	// dependencies to the build VM.
	CIDataImg string
	// ScratchImg points to an empty ext4 file system image that is used by the
	// provisioner for scratch space.
	ScratchImg string
	// contains filtered or unexported fields
}

Files stores important file paths.

func DefaultFiles

func DefaultFiles(persistentDir string) *Files

DefaultFiles builds a Files struct with a default file layout.

func (*Files) CleanupAllPersistent

func (f *Files) CleanupAllPersistent() error

CleanupAllPersistent deletes everything in the persistent directory.

Jump to

Keyboard shortcuts

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