Documentation
¶
Overview ¶
This package is a small go "library" (read: exec wrapper) around the mksquashfs binary that provides some useful primitives.
This file was initially copied from go-diskfs [1]. The copied portion is Copyright (c) 2017 Avi Deitcher and licensed under the terms of the MIT license [2].
[1] https://github.com/diskfs/go-diskfs/filesystem/squashfs/superblock.go [2] https://opensource.org/licenses/MIT
Index ¶
- Constants
- func ConfirmExistingVerityDeviceHash(devicePath string, rootHash string, allowVerityFailure bool) error
- func ExtractSingleSquash(squashFile string, extractDir string) error
- func ExtractSingleSquashPolicy(squashFile, extractDir string, policy *ExtractPolicy) error
- func GenerateSquashfsMediaType(comp SquashfsCompression, verity VerityMetadata) string
- func GuestMount(squashFile string, mountpoint string) error
- func HostMount(squashfs string, mountpoint string, rootHash string) error
- func IsSquashfsMediaType(mediaType string) bool
- func MakeSquashfs(tempdir string, rootfs string, eps *ExcludePaths, verity VerityMetadata) (io.ReadCloser, string, string, error)
- func Mount(squashfs, mountpoint, rootHash string) error
- func Umount(mountpoint string) error
- type ExcludePaths
- type ExtractPolicy
- type KernelExtractor
- type SquashExtractor
- type SquashFuseExtractor
- type SquashfsCompression
- type UnsquashfsExtractor
- type VerityMetadata
Constants ¶
const ( BaseMediaTypeLayerSquashfs = "application/vnd.stacker.image.layer.squashfs" GzipCompression SquashfsCompression = "gzip" ZstdCompression SquashfsCompression = "zstd" VerityMetadataPresent VerityMetadata = true VerityMetadataMissing VerityMetadata = false )
const VerityRootHashAnnotation = "io.stackeroci.stacker.squashfs_verity_root_hash"
Variables ¶
This section is empty.
Functions ¶
func ExtractSingleSquash ¶
ExtractSingleSquash - extract the squashFile to extractDir Initialize a extractPolicy struct and then call ExtractSingleSquashPolicy wik()th that.
func ExtractSingleSquashPolicy ¶
func ExtractSingleSquashPolicy(squashFile, extractDir string, policy *ExtractPolicy) error
ExtractSingleSquashPolicy - extract squashfile to extractDir
func GenerateSquashfsMediaType ¶
func GenerateSquashfsMediaType(comp SquashfsCompression, verity VerityMetadata) string
func GuestMount ¶
Mount a filesystem as container root, without host root privileges. We do this using squashfuse.
func IsSquashfsMediaType ¶
func MakeSquashfs ¶
func MakeSquashfs(tempdir string, rootfs string, eps *ExcludePaths, verity VerityMetadata) (io.ReadCloser, string, string, error)
Types ¶
type ExcludePaths ¶
type ExcludePaths struct {
// contains filtered or unexported fields
}
ExcludePaths represents a list of paths to exclude in a squashfs listing. Users should do something like filepath.Walk() over the whole filesystem, calling AddExclude() or AddInclude() based on whether they want to include or exclude a particular file. Note that if e.g. /usr is excluded, then everyting underneath is also implicitly excluded. The AddExclude()/AddInclude() methods do the math to figure out what is the correct set of things to exclude or include based on what paths have been previously included or excluded.
func NewExcludePaths ¶
func NewExcludePaths() *ExcludePaths
func (*ExcludePaths) AddExclude ¶
func (eps *ExcludePaths) AddExclude(p string)
func (*ExcludePaths) AddInclude ¶
func (eps *ExcludePaths) AddInclude(orig string, isDir bool)
func (*ExcludePaths) String ¶
func (eps *ExcludePaths) String() (string, error)
type ExtractPolicy ¶
type ExtractPolicy struct { Extractors []SquashExtractor Extractor SquashExtractor Excuses map[string]error // contains filtered or unexported fields }
func NewExtractPolicy ¶
func NewExtractPolicy(args ...string) (*ExtractPolicy, error)
type KernelExtractor ¶
type KernelExtractor struct {
// contains filtered or unexported fields
}
func (*KernelExtractor) IsAvailable ¶
func (k *KernelExtractor) IsAvailable() error
func (*KernelExtractor) Mount ¶
func (k *KernelExtractor) Mount(squashFile, extractDir string) error
func (*KernelExtractor) Name ¶
func (k *KernelExtractor) Name() string
type SquashExtractor ¶
type SquashFuseExtractor ¶
type SquashFuseExtractor struct {
// contains filtered or unexported fields
}
func (*SquashFuseExtractor) IsAvailable ¶
func (k *SquashFuseExtractor) IsAvailable() error
func (*SquashFuseExtractor) Mount ¶
func (k *SquashFuseExtractor) Mount(squashFile, extractDir string) error
func (*SquashFuseExtractor) Name ¶
func (k *SquashFuseExtractor) Name() string
type SquashfsCompression ¶
type SquashfsCompression string
type UnsquashfsExtractor ¶
type UnsquashfsExtractor struct {
// contains filtered or unexported fields
}
func (*UnsquashfsExtractor) IsAvailable ¶
func (k *UnsquashfsExtractor) IsAvailable() error
func (*UnsquashfsExtractor) Mount ¶
func (k *UnsquashfsExtractor) Mount(squashFile, extractDir string) error
func (*UnsquashfsExtractor) Name ¶
func (k *UnsquashfsExtractor) Name() string
type VerityMetadata ¶
type VerityMetadata bool
func HasVerityMetadata ¶
func HasVerityMetadata(mediaType string) VerityMetadata