Added handling of symbolic links in overlays

This commit is contained in:
mslacken
2022-01-14 16:56:18 +01:00
committed by Christian Goll
parent d4eab02b71
commit e0ab4e47f4

View File

@@ -262,6 +262,16 @@ func BuildOverlay(nodeInfo node.NodeInfo, overlayName string) error {
// } else if b, _ := regexp.MatchString(`\.ww[a-zA-Z0-9\-\._]*$`, location); b {
// wwlog.Printf(wwlog.DEBUG, "Ignoring WW template file: %s\n", location)
} else if info.Mode()&os.ModeSymlink == os.ModeSymlink {
wwlog.Printf(wwlog.DEBUG, "Found symlink %s\n", location)
destination, err := os.Readlink(location)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
}
err = os.Symlink(destination, path.Join(tmpDir, location))
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
}
} else {
err := util.CopyFile(location, path.Join(tmpDir, location))