Documentation ¶
Overview ¶
Package fs exports functionality related to all of the cos-customizer state stored on the file system.
Index ¶
- Constants
- func ArchiveHasObject(archive string, path string) (bool, error)
- func CopyDir(src string, dst string, mode fs.FileMode) error
- func CopyFile(src string, dst string, mode fs.FileMode) error
- func CopyRecursive(src string, dst string) error
- func CreateBuildContextArchive(src, dst string) error
- func ExtractFile(inputFile, destDir string) error
- func GzipFile(inPath, outPath string) (err error)
- func IsDir(path string) bool
- func IsFile(path string) bool
- func ReadObjectFromArchive(archive string, path string) ([]byte, error)
- func TarDir(root, dst string) error
- func TarFile(src, dst string) error
- type Files
Constants ¶
const (
// ScratchDir is used for temp files and the like.
ScratchDir = "/tmp"
)
Variables ¶
This section is empty.
Functions ¶
func ArchiveHasObject ¶
ArchiveHasObject determines if the given tar archive contains the given object.
func CopyDir ¶
CopyDir copies a source directory to a target directory, preserving file permissions. This should be faster than calling `cp -r <src> <dst>` for small directories.
func CopyRecursive ¶
CopyRecursive calls 'cp -r <src> <dst>'.
func CreateBuildContextArchive ¶
CreateBuildContextArchive creates a tar archive of the given build context.
func ExtractFile ¶
ExtractFile decompresses the tar file at inputFile to destDir.
func GzipFile ¶
GzipFile compresses the file at the input path and saves the result at the output path.
func IsDir ¶
IsDir returns whether or not a path exists and is a directory or is a symlink to a directory.
func ReadObjectFromArchive ¶
ReadObjectFromArchive reads the given object in the given tar archive.
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 ¶
DefaultFiles builds a Files struct with a default file layout.
func (*Files) CleanupAllPersistent ¶
CleanupAllPersistent deletes everything in the persistent directory.