From aadfdfe1e603f66425f7a23c7a0a1e1d6c73bc6e Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Thu, 17 Mar 2022 15:36:07 +0100 Subject: [PATCH] remove rootfs from overlaydir if exits --- internal/pkg/overlay/config.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/pkg/overlay/config.go b/internal/pkg/overlay/config.go index 92879822..c9b80306 100644 --- a/internal/pkg/overlay/config.go +++ b/internal/pkg/overlay/config.go @@ -1,6 +1,7 @@ package overlay import ( + "os" "path" "strings" @@ -11,8 +12,18 @@ func OverlaySourceTopDir() string { return buildconfig.WWOVERLAYDIR() } +/* +Return the path for the base of the overlay, strips rootfs +prefix in the overlay dir if this it exists +*/ func OverlaySourceDir(overlayName string) string { - return path.Join(OverlaySourceTopDir(), overlayName) + /* Assume using old style overlay dir without rootfs */ + var overlaypath = path.Join(OverlaySourceTopDir(), overlayName) + if _, err := os.Stat(path.Join(overlaypath, "rootfs")); err == nil { + /* rootfs exists, use it. */ + overlaypath = path.Join(overlaypath, "rootfs") + } + return overlaypath } /*