tar

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChrootUntar

func ChrootUntar(tr *tar.Reader, targetDir string, cfg ExtractCfg) error

ChrootUntar extracts a tar reader into a target destination, by first chroot-ing into it.

func Create

func Create(w io.Writer, root string) error

func ExtractRoot

func ExtractRoot(tr *tar.Reader, cfg ExtractCfg) error

ExtractRoot reads tar entries from r until EOF and creates filesystem entries rooted in "/". It is supposed to be used by a process already chroot'ed into target destination.

Behavior changes according to flag, bitwise-or of the above constants:

If Chmod is unset, dirs are created with mode 0755 and files wit 0666. Both are subject to umask.

Only numerical uid and gid are handled, no shift or name resolution is applied.

Types

type ExtractCfg

type ExtractCfg struct {
	// Link - whether to create hard links
	HardLink bool
	// Symlink - whether to create symlinks
	Symlink bool
	// Chown - whether to set file uid and gid
	Chown bool
	// Chmod - whether to set file mode
	Chmod bool
	// Chtimes - whether to set atime and mtime
	Chtimes bool
	// XattrUser - whether to set user extend attributes
	XattrUser bool
	// XattrPrivileged - attempt to set non-user extend attributes
	XattrPrivileged bool
	// UIDShift - positive increment to uid (requires Chown)
	UIDShift uint
	// GIDShift - positive increment to gid (requires Chown)
	GIDShift uint
}

ExtractCfg holds configuration for a tar extractor

func (ExtractCfg) Default

func (ec ExtractCfg) Default() ExtractCfg

Default returns a default configuration for extract operations

Jump to

Keyboard shortcuts

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