Documentation ¶
Overview ¶
Package util contains various u-root utility functions.
Index ¶
- Constants
- Variables
- func AbsSymlink(originalFile, target string) string
- func FindFileSystem(fs string) error
- func GoBin() string
- func IsTargetSymlink(originalFile, target string) bool
- func ResolveUntilLastSymlink(p string) string
- func Rootfs()
- func UrootPath(n ...string) string
- func Usage(cmd string)
- type Creator
- type Dev
- type Dir
- type File
- type Link
- type Mount
- type Symlink
Constants ¶
const ( // Not all these paths may be populated or even exist but OTOH they might. PATHHEAD = "/ubin" PATHMID = "/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/local/sbin" PATHTAIL = "/buildbin:/bbin" )
Variables ¶
var (
Env = map[string]string{
"LD_LIBRARY_PATH": "/usr/local/lib",
"GOROOT": "/go",
"GOPATH": "/",
"GOBIN": "/ubin",
"CGO_ENABLED": "0",
}
)
Functions ¶
func AbsSymlink ¶
AbsSymlink returns an absolute path for the link from a file to a target.
func FindFileSystem ¶
FindFileSystem returns nil if a file system is installed. It rereads /proc/filesystems each time as the supported file systems can change as modules are added and removed.
func IsTargetSymlink ¶
IsTargetSymlink returns true if a target of a symlink is also a symlink.
func ResolveUntilLastSymlink ¶
ResolveUntilLastSymlink resolves until the last symlink. This is needed when we have a chain of symlinks and want the last symlink, not the file pointed to (which is why we don't use filepath.EvalSymlinks)
func UrootPath ¶
UrootPath returns the full path for a uroot file with the UROOT_ROOT environment variable taken into account. It returns a proper value if UROOT_ROOT is not set. u-root was built to assume everything is rooted at /, and in most cases that is still true. But in hosted mode, e.g. on developer mode chromebooks, it's far better if u-root can be rooted in /usr/local, so successive kernel/root file system upgrades do not wipe it out.