Documentation ¶
Index ¶
- Constants
- Variables
- func AppendToFile(target string, data []byte, preserveTimes bool) error
- func ArchiveDir(afname string, d2aname string, trimPrefix string, addPrefix string) error
- func ArchiveFiles(afname string, files []string, removePath bool, addPrefix string) error
- func CopyAndObfuscateFile(clone bool, src string, dst string, makeDir bool) error
- func CopyDir(clone bool, src string, dst string, copyRelPath bool, skipErrors bool, ...) (error, []error)
- func CopyDirOnly(clone bool, src, dst string) error
- func CopyFile(clone bool, src, dst string, makeDir bool) error
- func CopyRegularFile(clone bool, src, dst string, makeDir bool) error
- func CopySymlinkFile(clone bool, src, dst string, makeDir bool) error
- func DirExists(target string) bool
- func ExeDir() string
- func Exists(target string) bool
- func FileDir(fileName string) string
- func FileMode(fileName string) string
- func FileModeExtraBitUnix2Go(bit uint32) os.FileMode
- func FileModeExtraBitsUnix2Go(bits uint32) os.FileMode
- func FileModeExtraUnix2Go(mode uint32) os.FileMode
- func FileModeIsSetgid(mode os.FileMode) bool
- func FileModeIsSetuid(mode os.FileMode) bool
- func FileModeIsSticky(mode os.FileMode) bool
- func HasReadAccess(dst string) (bool, error)
- func HasWriteAccess(dst string) (bool, error)
- func IsDir(target string) bool
- func IsRegularFile(target string) bool
- func IsSymlink(target string) bool
- func IsTarFile(target string) bool
- func LoadStructFromFile(filePath string, out interface{}) error
- func PrepareImageStateDirs(statePrefix, imageID string) (string, string, string, string)
- func PreparePostUpdateStateDir(statePrefix string)
- func PrepareReleaseStateDirs(statePrefix, version string) (string, string)
- func Remove(artifactLocation string) error
- func ReplaceFileData(target string, replace []ReplaceInfo, preserveTimes bool) error
- func ResolveImageStateBasePath(statePrefix string) string
- func SetAccess(dst string, access *AccessInfo) error
- func Touch(target string) error
- func UpdateFileData(target string, updater DataUpdaterFn, preserveTimes bool) error
- func UpdateFileTimes(target string, atime, mtime syscall.Timespec) error
- func UpdateSymlinkTimes(target string, atime, mtime syscall.Timespec) error
- type AccessInfo
- type DataUpdaterFn
- type ReplaceInfo
- type SysStat
Constants ¶
const ( FilePermUserExe = 0100 FilePermGroupExe = 0010 FilePermOtherExe = 0001 )
File permission bits (execute bits only)
const ( FMSticky = 01000 FMSetgid = 02000 FMSetuid = 04000 )
Native FileModes for extra flags
const ( BitSticky = 1 BitSetgid = 2 BitSetuid = 4 )
Native FileMode bits for extra flags
const FMSpecialBits = os.ModeSticky | os.ModeSetgid | os.ModeSetuid
Native FileMode special bits mask
Variables ¶
var ( ErrNoFileData = errors.New("no file data") ErrNoSrcDir = errors.New("no source directory path") ErrNoDstDir = errors.New("no destination directory path") ErrSameDir = errors.New("source and destination directories are the same") ErrSrcDirNotExist = errors.New("source directory doesn't exist") ErrSrcNotDir = errors.New("source is not a directory") ErrSrcNotRegularFile = errors.New("source is not a regular file") ErrUnsupportedFileObjectType = errors.New("unsupported file object type") )
Directory and file related errors
Functions ¶
func AppendToFile ¶
AppendToFile appends the provided data to the target file
func ArchiveDir ¶
func ArchiveFiles ¶
func CopyAndObfuscateFile ¶
CopyAndObfuscateFile copies a regular file and performs basic file reference obfuscation
func CopyDir ¶
func CopyDir(clone bool, src string, dst string, copyRelPath bool, skipErrors bool, excludePatterns []string, ignoreDirNames map[string]struct{}, ignoreFileNames map[string]struct{}) (error, []error)
CopyDir copies a directory
func CopyDirOnly ¶
CopyDirOnly copies a directory without any files
func CopyRegularFile ¶
CopyRegularFile copies a regular file
func CopySymlinkFile ¶
CopySymlinkFile copies a symlink file
func FileModeExtraBitUnix2Go ¶
FileModeExtraBitUnix2Go converts the standard unix filemode bit for the extra flags to the filemode in Go
func FileModeExtraBitsUnix2Go ¶
FileModeExtraBitsUnix2Go converts the standard unix filemode bits for the extra flags to the filemode flags in Go
func FileModeExtraUnix2Go ¶
FileModeExtraUnix2Go converts the standard unix filemode for the extra flags to the Go version
func FileModeIsSetgid ¶
FileModeIsSetgid checks if FileMode has the setgid bit set
func FileModeIsSetuid ¶
FileModeIsSetuid checks if FileMode has the setuid bit set
func FileModeIsSticky ¶
FileModeIsSticky checks if FileMode has the sticky bit set
func HasReadAccess ¶
func HasWriteAccess ¶
func IsRegularFile ¶
IsRegularFile returns true if the target file system object is a regular file
func LoadStructFromFile ¶
LoadStructFromFile creates a struct from a file
func PrepareImageStateDirs ¶
PrepareImageStateDirs ensures that the required application directories exist
func PreparePostUpdateStateDir ¶
func PreparePostUpdateStateDir(statePrefix string)
PreparePostUpdateStateDir ensures that the updated sensor is copied to the state directory if necessary
func PrepareReleaseStateDirs ¶
PrepareReleaseStateDirs ensures that the required app release directories exist
func ReplaceFileData ¶
func ReplaceFileData(target string, replace []ReplaceInfo, preserveTimes bool) error
ReplaceFileData replaces the selected file bytes with the caller provided bytes
func ResolveImageStateBasePath ¶
ResolveImageStateBasePath resolves the base path for the state path
func SetAccess ¶
func SetAccess(dst string, access *AccessInfo) error
SetAccess updates the access permissions on the destination
func UpdateFileData ¶
func UpdateFileData(target string, updater DataUpdaterFn, preserveTimes bool) error
UpdateFileData updates all file data in target file using the updater function
func UpdateFileTimes ¶
UpdateFileTimes updates the atime and mtime timestamps on the target file
Types ¶
type AccessInfo ¶
AccessInfo provides the file object access properties
func NewAccessInfo ¶
func NewAccessInfo() *AccessInfo