Versions in this module Expand all Collapse all v0 v0.1.0 Nov 12, 2022 v0.0.1 Nov 10, 2022 Changes in this version + const FS_APPEND_FL + const FS_BTREE_FL + const FS_COMPRBLK_FL + const FS_COMPR_FL + const FS_DIRECTIO_FL + const FS_DIRSYNC_FL + const FS_DIRTY_FL + const FS_ECOMPR_FL + const FS_EXTENT_FL + const FS_IMAGIC_FL + const FS_IMMUTABLE_FL + const FS_INDEX_FL + const FS_JOURNAL_DATA_FL + const FS_NOATIME_FL + const FS_NOCOMP_FL + const FS_NOCOW_FL + const FS_NODUMP_FL + const FS_NOTAIL_FL + const FS_PROJINHERIT_FL + const FS_RESERVED_FL + const FS_SECRM_FL + const FS_SYNC_FL + const FS_TOPDIR_FL + const FS_UNRM_FL + const NoChown + var ErrAlreadyLocked = errors.New("cannot acquire lock, already locked") + var ErrCannotCancel = errors.New("cannot cancel: file has already been renamed") + var ErrDarwin = errors.New("not implemented on darwin") — darwin/amd64 + var ErrNoBuildID = errors.New("executable does not contain a build ID") + var ErrSameState = fmt.Errorf("file state has not changed") + var FindGid = findGid + var FindUid = findUid + var IsValidUsername = regexp.MustCompile(`^[a-z0-9][-a-z0-9+._]*$`).MatchString + var KernelVersion = kernelVersion + func AddUser(name string, opts *AddUserOptions) error + func AtomicRename(oldName, newName string) error + func AtomicSymlink(target, linkPath string) error + func AtomicWrite(filename string, reader io.Reader, perm os.FileMode, flags AtomicWriteFlags) (err error) + func AtomicWriteChown(filename string, reader io.Reader, perm os.FileMode, flags AtomicWriteFlags, ...) (err error) + func AtomicWriteFile(filename string, data []byte, perm os.FileMode, flags AtomicWriteFlags) (err error) + func AtomicWriteFileChown(filename string, data []byte, perm os.FileMode, flags AtomicWriteFlags, ...) (err error) + func AtomicWriteFileCopy(dst, src string, flags AtomicWriteFlags) (err error) + func BootID() (string, error) + func ChDir(newDir string, f func() error) (err error) + func CheckFreeSpace(path string, minSize uint64) error + func ContextWriter(ctx context.Context) io.Writer + func CopyFile(src, dst string, flags CopyFlag) (err error) + func CopySpecialFile(path, dest string) error + func DelUser(name string, opts *DelUserOptions) error + func DirExists(fn string) (exists bool, isDir bool, err error) + func EnsureDirState(dir string, glob string, content map[string]FileState) (changed, removed []string, err error) + func EnsureDirStateGlobs(dir string, globs []string, content map[string]FileState) (changed, removed []string, err error) + func EnsureFileState(filePath string, state FileState) error + func EnsureTreeState(baseDir string, globs []string, content map[string]map[string]FileState) (changed, removed []string, err error) + func EnsureUserGroup(name string, id uint32, extraUsers bool) error + func Escape(path string) string + func ExecutableExists(name string) bool + func ExitCode(runErr error) (e int, err error) + func FileDigest(filename string, hash crypto.Hash) ([]byte, uint64, error) + func FileExists(path string) bool + func FilesAreEqual(a, b string) bool + func FindGidOwning(path string) (uint64, error) + func GetAttr(f *os.File) (int32, error) + func GetenvBool(key string, dflt ...bool) bool + func GetenvInt64(key string, dflt ...int64) int64 + func IsDevice(mode os.FileMode) bool + func IsDirNotExist(err error) bool + func IsDirectory(path string) bool + func IsExecutable(path string) bool + func IsHomeUsingNFS() (bool, error) — darwin/amd64, linux/amd64 + func IsMounted(baseDir string) (bool, error) — darwin/amd64, linux/amd64 + func IsRootWritableOverlay() (string, error) — darwin/amd64, linux/amd64 + func IsSymlink(path string) bool + func IsTestBinary() bool + func IsUnknownGroup(err error) bool + func IsUnknownUser(err error) bool + func IsWritable(path string) bool + func KernelCommandLine() (string, error) + func KernelCommandLineKeyValues(keys ...string) (map[string]string, error) + func KernelCommandLineSplit(s string) (out []string, err error) + func KillProcessGroup(cmd *exec.Cmd) error + func LookPathDefault(name string, defaultPath string) string + func MachineName() string + func MaybeInjectFault(tag string) + func MkdirAllChown(path string, perm os.FileMode, uid sys.UserID, gid sys.GroupID) error + func MockFindGid(f func(string) (uint64, error)) (restore func()) + func MockFindUid(f func(string) (uint64, error)) (restore func()) + func MockKernelVersion(version string) (restore func()) + func MockMountInfo(content string) (restore func()) — darwin/amd64, linux/amd64 + func MockProcCmdline(newPath string) (restore func()) + func MockProcMeminfo(newPath string) (restore func()) + func MockProcSelfMountInfoLocation(filename string) (restore func()) — linux/amd64 + func MountOptsToCommonFlags(opts []string) (flags int, unparsed []string) — linux/amd64 + func MountOptsToFlags(opts []string) (flags int, err error) — linux/amd64 + func MustBeTestBinary(panicMsg string) + func MyBuildID() (string, error) + func OutputErr(output []byte, err error) error + func ReadBuildID(fname string) (string, error) + func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) — linux/amd64 + func RegularFileExists(fn string) (exists, isReg bool, err error) + func RunAndWait(argv []string, env []string, timeout time.Duration, tomb *tomb.Tomb) ([]byte, error) + func RunWithContext(ctx context.Context, cmd *exec.Cmd) error + func SaveMountProfileText(p *MountProfile) (string, error) — linux/amd64 + func SetAttr(f *os.File, attr int32) error + func SetTime(t time.Time) error + func StreamCommand(name string, args ...string) (io.ReadCloser, error) + func StreamsEqual(a, b io.Reader) bool + func Symlinkat(target string, dirfd int, linkpath string) error — linux/amd64 + func TotalUsableMemory() (totalMem uint64, err error) + func UidGid(u *user.User) (sys.UserID, sys.GroupID, error) + func Unescape(path string) string + func UnlinkMany(dirname string, filenames []string) error + func UnlinkManyAt(dir *os.File, filenames []string) error + func UserMaybeSudoUser() (*user.User, error) + func XSnapdDetach() string + func XSnapdGroup(gid uint32) string + func XSnapdIgnoreMissing() string + func XSnapdKindFile() string + func XSnapdKindSymlink() string + func XSnapdMode(mode uint32) string + func XSnapdNeededBy(path string) string + func XSnapdOriginLayout() string + func XSnapdOriginOvername() string + func XSnapdSymlink(oldname string) string + func XSnapdSynthetic() string + func XSnapdUser(uid uint32) string + type AddUserOptions struct + ExtraUsers bool + ForcePasswordChange bool + Gecos string + Password string + SSHKeys []string + Sudoer bool + type AtomicFile struct + func NewAtomicFile(filename string, perm os.FileMode, flags AtomicWriteFlags, uid sys.UserID, ...) (aw *AtomicFile, err error) + func (aw *AtomicFile) Cancel() error + func (aw *AtomicFile) Close() error + func (aw *AtomicFile) Commit() error + func (aw *AtomicFile) CommitAs(filename string) error + func (aw *AtomicFile) SetModTime(t time.Time) + type AtomicWriteFlags uint + const AtomicWriteFollow + type CopyFlag uint8 + const CopyFlagDefault + const CopyFlagOverwrite + const CopyFlagPreserveAll + const CopyFlagSync + type CopySpecialFileError struct + func (e CopySpecialFileError) Error() string + type DelUserOptions struct + ExtraUsers bool + type Environment map[string]string + func OSEnvironment() (Environment, error) + func OSEnvironmentUnescapeUnsafe(unsafeEscapePrefix string) (Environment, error) + func (env *Environment) ExtendWithExpanded(eenv ExpandableEnv) + func (env Environment) ForExec() []string + func (env Environment) ForExecEscapeUnsafe(unsafeEscapePrefix string) []string + type ExpandableEnv struct + func NewExpandableEnv(pairs ...string) ExpandableEnv + type FileLock struct + func NewFileLock(path string) (*FileLock, error) + func NewFileLockWithMode(path string, mode os.FileMode) (*FileLock, error) + func OpenExistingLockForReading(path string) (*FileLock, error) + func (l *FileLock) Close() error + func (l *FileLock) File() *os.File + func (l *FileLock) Lock() error + func (l *FileLock) Path() string + func (l *FileLock) ReadLock() error + func (l *FileLock) TryLock() error + func (l *FileLock) Unlock() error + type FileReference struct + Path string + func (fref FileReference) State() (io.ReadCloser, int64, os.FileMode, error) + type FileReferencePlusMode struct + Mode os.FileMode + func (fcref FileReferencePlusMode) State() (io.ReadCloser, int64, os.FileMode, error) + type FileState interface + State func() (reader io.ReadCloser, size int64, mode os.FileMode, err error) + type MemoryFileState struct + Content []byte + Mode os.FileMode + func (blob *MemoryFileState) State() (io.ReadCloser, int64, os.FileMode, error) + type MountEntry struct + CheckPassNumber int + Dir string + DumpFrequency int + Name string + Options []string + Type string + func ParseMountEntry(s string) (MountEntry, error) + func (e *MountEntry) Equal(o *MountEntry) bool + func (e *MountEntry) OptBool(name string) bool + func (e *MountEntry) OptStr(name string) (string, bool) + func (e *MountEntry) XSnapdDetach() bool + func (e *MountEntry) XSnapdEntryID() string + func (e *MountEntry) XSnapdGID() (gid uint64, err error) + func (e *MountEntry) XSnapdIgnoreMissing() bool + func (e *MountEntry) XSnapdKind() string + func (e *MountEntry) XSnapdMode() (os.FileMode, error) + func (e *MountEntry) XSnapdNeededBy() string + func (e *MountEntry) XSnapdOrigin() string + func (e *MountEntry) XSnapdSymlink() string + func (e *MountEntry) XSnapdSynthetic() bool + func (e *MountEntry) XSnapdUID() (uid uint64, err error) + func (e MountEntry) String() string + type MountInfoEntry struct + DevMajor int + DevMinor int + FsType string + MountDir string + MountID int + MountOptions map[string]string + MountSource string + OptionalFields []string + ParentID int + Root string + SuperOptions map[string]string + func LoadMountInfo() ([]*MountInfoEntry, error) + func ParseMountInfoEntry(s string) (*MountInfoEntry, error) + func ReadMountInfo(reader io.Reader) ([]*MountInfoEntry, error) + func (mi *MountInfoEntry) String() string + type MountProfile struct — linux/amd64 + Entries []MountEntry + func LoadMountProfile(fname string) (*MountProfile, error) + func LoadMountProfileText(fstab string) (*MountProfile, error) + func ReadMountProfile(reader io.Reader) (*MountProfile, error) + func (p *MountProfile) Save(fname string) error + func (p *MountProfile) WriteTo(writer io.Writer) (int64, error) + type NotEnoughDiskSpaceError struct + Delta int64 + Path string + func (e *NotEnoughDiskSpaceError) Error() string + type Sizer struct + func (sz *Sizer) Reset() + func (sz *Sizer) Size() int64 + func (sz *Sizer) Write(data []byte) (n int, err error) + type Winsize struct + Col uint16 + Row uint16 + Ypixel uint16 + func GetTermWinsize() (*Winsize, error)