Merge pull request #1698 from anderbubble/overlay-create-root-dir

Create site overlay directory
This commit is contained in:
Christian Goll
2025-02-04 09:03:33 +01:00
committed by GitHub
3 changed files with 8 additions and 3 deletions

View File

@@ -14,9 +14,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- `wwctl node list <--yaml|--json>` outputs a map keyed by node name. #1667
### Changes
- Don't mount /run during wwinit. #1566
### Fixed
@@ -33,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Don't attempt to back-up an output file that doesn't exist during upgrade. #1671
- Specify init=/init when booting with Grub+dracut. #1573
- Fix a warewulfd panic when no kernel fields are specified. #1689
- Create site overlay directory. #1690
## v4.6.0rc1, 2025-01-29

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
}

View File

@@ -190,6 +190,7 @@ getent group %{wwgroup} >/dev/null || groupadd -r %{wwgroup}
%dir %{_sharedstatedir}/warewulf
%dir %{_sharedstatedir}/warewulf/chroots
%dir %{_sharedstatedir}/warewulf/overlays
%dir %{_datadir}/warewulf/overlays
%dir %{_datadir}/warewulf/overlays/*
%dir %{_datadir}/warewulf/overlays/*/rootfs