github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/pkg/upath/urootpath.go (about) 1 // Copyright 2015-2017 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package upath 6 7 import ( 8 "os" 9 "path/filepath" 10 ) 11 12 var root = os.Getenv("UROOT_ROOT") 13 14 // UrootPath returns the absolute path for a uroot file with the UROOT_ROOT 15 // environment variable taken into account. 16 // 17 // It returns a proper value if UROOT_ROOT is not set. u-root was built to 18 // assume everything is rooted at /, and in most cases that is still true. But 19 // in hosted mode, e.g. on developer mode chromebooks, it's far better if 20 // u-root can be rooted in /usr/local, so successive kernel/root file system 21 // upgrades do not wipe it out. 22 func UrootPath(n ...string) string { 23 return filepath.Join("/", root, filepath.Join(n...)) 24 }