Since BaseConf.New could return a cached BaseConf, rather than always constructing a new struct, I've renamed it to Get to more accurately reflect its use. A new New() method is called by Get and always initializes a new struct. Signed-off-by: Jonathon Anderson <janderson@ciq.co>
30 lines
573 B
Go
30 lines
573 B
Go
package container
|
|
|
|
import (
|
|
"path"
|
|
|
|
warewulfconf "github.com/hpcng/warewulf/internal/pkg/config"
|
|
)
|
|
|
|
func SourceParentDir() string {
|
|
conf := warewulfconf.Get()
|
|
return conf.Paths.WWChrootdir
|
|
}
|
|
|
|
func SourceDir(name string) string {
|
|
return path.Join(SourceParentDir(), name)
|
|
}
|
|
|
|
func RootFsDir(name string) string {
|
|
return path.Join(SourceDir(name), "rootfs")
|
|
}
|
|
|
|
func ImageParentDir() string {
|
|
conf := warewulfconf.Get()
|
|
return path.Join(conf.Paths.WWProvisiondir, "container/")
|
|
}
|
|
|
|
func ImageFile(name string) string {
|
|
return path.Join(ImageParentDir(), name+".img")
|
|
}
|