1
0

feat: get container path relative to config dir

This commit is contained in:
dump_stack() 2023-05-14 07:24:49 +00:00
parent 93a1b74e34
commit 78626c10af
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 5 additions and 15 deletions

View File

@ -66,6 +66,10 @@ func Images() (diis []Image, err error) {
return
}
func ImagePath(sk config.KernelMask) string {
return config.Dir("containers", sk.DistroType.String(), sk.DistroRelease)
}
type Container struct {
name string

View File

@ -110,17 +110,6 @@ func MatchPackages(km config.KernelMask) (pkgs []string, err error) {
return
}
func dockerImagePath(sk config.KernelMask) (path string, err error) {
usr, err := user.Current()
if err != nil {
return
}
path = usr.HomeDir + "/.out-of-tree/containers/"
path += sk.DistroType.String() + "/" + sk.DistroRelease
return
}
func vsyscallAvailable() (available bool, err error) {
if runtime.GOOS != "linux" {
// Docker for non-Linux systems is not using the host
@ -142,10 +131,7 @@ func vsyscallAvailable() (available bool, err error) {
func GenerateBaseDockerImage(registry string, commands []config.DockerCommand,
sk config.KernelMask, forceUpdate bool) (err error) {
imagePath, err := dockerImagePath(sk)
if err != nil {
return
}
imagePath := container.ImagePath(sk)
dockerPath := imagePath + "/Dockerfile"
d := "# BASE\n"