Create site overlay directory

-Fixes: #1690

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-02-03 04:18:13 -07:00
committed by Christian Goll
parent 5517a26c6f
commit 38791c74ad
3 changed files with 8 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"strings"
"github.com/containers/storage/drivers/copy"
@@ -67,6 +68,11 @@ func (overlay Overlay) CloneSiteOverlay() (siteOverlay Overlay, err error) {
if siteOverlay.Exists() {
return siteOverlay, fmt.Errorf("site overlay already exists: %s", siteOverlay.Name())
}
if !util.IsDir(filepath.Dir(overlay.Path())) {
if err := os.MkdirAll(filepath.Dir(overlay.Path()), 0755); err != nil {
return siteOverlay, err
}
}
err = copy.DirCopy(overlay.Path(), siteOverlay.Path(), copy.Content, true)
return siteOverlay, err
}