Set execute permissions for intermediate directories

- Fixes: #1655

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-02-05 20:03:38 -07:00
parent 36dca0dfa3
commit 6a250f3f96
3 changed files with 8 additions and 4 deletions

View File

@@ -33,6 +33,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- 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
- Set execute permissions for intermediate directories during `wwctl overlay import --parents`. #1655
- Fix log output formatting during overlay build.
## v4.6.0rc1, 2025-01-29

View File

@@ -51,11 +51,13 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
wwlog.Debug("Create dir: %s", parent)
srcInfo, err := os.Stat(source)
if err != nil {
return fmt.Errorf("could not retrieve the stat for file: %s", err)
return fmt.Errorf("could not retrieve the stat for file: %w", err)
}
err = os.MkdirAll(parent, srcInfo.Mode())
mode := srcInfo.Mode()
mode |= ((mode & 0444) >> 2) // add execute permission wherever srcInfo has read
err = os.MkdirAll(parent, mode)
if err != nil {
return fmt.Errorf("could not create parent dif: %s: %v", parent, err)
return fmt.Errorf("could not create parent dir: %s: %w", parent, err)
}
}
}

View File

@@ -146,7 +146,7 @@ func BuildSpecificOverlays(nodes []node.Node, allNodes []node.Node, overlayNames
var wg sync.WaitGroup
worker := func() {
for n := range nodeChan {
wwlog.Info("Building overlay for %s: %v", n, overlayNames)
wwlog.Info("Building overlay for %s: %v", n.Id(), overlayNames)
for _, overlayName := range overlayNames {
err := BuildOverlay(n, allNodes, "", []string{overlayName})
if err != nil {