From 386ce459909aaa2fcbfd35d2a3eb3293a38b648e Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Wed, 8 Jun 2022 10:06:37 +0200 Subject: [PATCH 1/2] add softlink of dhcpd.conf in /etc openSUSE based distos and other distros use `/etc/dhcpd.conf` instead of `/etc/dhpd/dhcpd.conf` --- overlays/host/etc/dhcpd.conf | 1 + 1 file changed, 1 insertion(+) create mode 120000 overlays/host/etc/dhcpd.conf diff --git a/overlays/host/etc/dhcpd.conf b/overlays/host/etc/dhcpd.conf new file mode 120000 index 00000000..fe112f7e --- /dev/null +++ b/overlays/host/etc/dhcpd.conf @@ -0,0 +1 @@ +dhcp/dhcpd.conf \ No newline at end of file From ecea7a949f5029577d0c75c96d2cf8bc03d5938f Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Wed, 8 Jun 2022 10:33:49 +0200 Subject: [PATCH 2/2] create symlink if target exists --- internal/pkg/overlay/overlay.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/pkg/overlay/overlay.go b/internal/pkg/overlay/overlay.go index 634b5082..df2b317e 100644 --- a/internal/pkg/overlay/overlay.go +++ b/internal/pkg/overlay/overlay.go @@ -417,12 +417,23 @@ func BuildOverlayIndir(nodeInfo node.NodeInfo, overlayNames []string, outputDir if err != nil { wwlog.ErrorExc(err, "") } + if util.IsFile(path.Join(outputDir, location)) { + if !util.IsFile(path.Join(outputDir, location+".wwbackup")) { + wwlog.Debug("Target exists, creating backup file") + err = os.Rename(path.Join(outputDir, location), path.Join(outputDir, location+"wwbackup")) + } else { + wwlog.Debug("%s exists, keeping the backup file", path.Join(outputDir, location+".wwbackup")) + err = os.Remove(path.Join(outputDir, location)) + } + if err != nil { + wwlog.ErrorExc(err, "") + } + } err = os.Symlink(destination, path.Join(outputDir, location)) if err != nil { wwlog.ErrorExc(err, "") } } else { - err := util.CopyFile(location, path.Join(outputDir, location)) if err == nil { wwlog.Debug("Copied file into overlay: %s", location)