diff --git a/Makefile b/Makefile index 8cf15d54..55eb8aee 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,8 @@ install: build docs install -d -m 0755 $(DESTDIR)$(SYSTEMDDIR) install -d -m 0755 $(DESTDIR)$(IPXESOURCE) install -d -m 0755 $(DESTDIR)$(DATADIR)/warewulf - test -f $(DESTDIR)$(WWCONFIGDIR)/warewulf.conf || install -m 0644 etc/warewulf.conf $(DESTDIR)$(WWCONFIGDIR) + # wwctl genconfig to get the compiled in paths to warewulf.conf + test -f $(DESTDIR)$(WWCONFIGDIR)/warewulf.conf || ./wwctl --warewulfconf etc/warewulf.conf genconfig warewulfconf print> $(DESTDIR)$(WWCONFIGDIR)/warewulf.conf test -f $(DESTDIR)$(WWCONFIGDIR)/nodes.conf || install -m 0644 etc/nodes.conf $(DESTDIR)$(WWCONFIGDIR) test -f $(DESTDIR)$(WWCONFIGDIR)/wwapic.conf || install -m 0644 etc/wwapic.conf $(DESTDIR)$(WWCONFIGDIR) test -f $(DESTDIR)$(WWCONFIGDIR)/wwapid.conf || install -m 0644 etc/wwapid.conf $(DESTDIR)$(WWCONFIGDIR) diff --git a/internal/pkg/config/buildconfig.go.in b/internal/pkg/config/buildconfig.go.in index bfa771f1..6f761cc1 100644 --- a/internal/pkg/config/buildconfig.go.in +++ b/internal/pkg/config/buildconfig.go.in @@ -13,10 +13,19 @@ type BuildConfig struct { WWOverlaydir string `default:"@WWOVERLAYDIR@"` WWChrootdir string `default:"@WWCHROOTDIR@"` WWProvisiondir string `default:"@WWPROVISIONDIR@"` - Version string `default:"@VERSION@"` - Release string `default:"@RELEASE@"` WWClientdir string `default:"@WWCLIENTDIR@"` + version string `default:"@VERSION@"` + release string `default:"@RELEASE@"` } + +func (conf BuildConfig) Version() string { + return conf.version +} + +func (conf BuildConfig) Release() string { + return conf.release +} + type TFTPConf struct { Enabled bool `yaml:"enabled" default:"true"` TftpRoot string `yaml:"tftproot" default:"@TFTPDIR@"` @@ -24,6 +33,7 @@ type TFTPConf struct { IpxeBinaries map[string]string `yaml:"ipxe" default:"{\"00:09\": \"ipxe-snponly-x86_64.efi\",\"00:00\": \"undionly.kpxe\",\"00:0B\": \"arm64-efi/snponly.efi\",\"00:07\": \"ipxe-snponly-x86_64.efi\"}"` } + // WarewulfConf adds additional Warewulf-specific configuration to // BaseConf. type WarewulfConf struct { diff --git a/internal/pkg/version/version.go b/internal/pkg/version/version.go index b3d7648e..1db687cb 100644 --- a/internal/pkg/version/version.go +++ b/internal/pkg/version/version.go @@ -12,7 +12,7 @@ Return the version of wwctl */ func GetVersion() string { conf := warewulfconf.Get() - return fmt.Sprintf("%s-%s", conf.Paths.Version, conf.Paths.Release) + return fmt.Sprintf("%s-%s", conf.Paths.Version(), conf.Paths.Release()) } /* diff --git a/internal/pkg/warewulfd/copyshim.go b/internal/pkg/warewulfd/copyshim.go index c17a8bc5..4f085017 100644 --- a/internal/pkg/warewulfd/copyshim.go +++ b/internal/pkg/warewulfd/copyshim.go @@ -24,22 +24,22 @@ func CopyShimGrub() (err error) { if shimPath == "" { return fmt.Errorf("no shim found on the host os") } - err = util.CopyFile(shimPath, path.Join(conf.Paths.Tftpdir, "warewulf", "shim.efi")) + err = util.CopyFile(shimPath, path.Join(conf.TFTP.TftpRoot, "warewulf", "shim.efi")) if err != nil { return err } - _ = os.Chmod(path.Join(conf.Paths.Tftpdir, "warewulf", "shim.efi"), 0o755) + _ = os.Chmod(path.Join(conf.TFTP.TftpRoot, "warewulf", "shim.efi"), 0o755) grubPath := container.GrubFind("") if grubPath == "" { return fmt.Errorf("no grub found on host os") } - err = util.CopyFile(grubPath, path.Join(conf.Paths.Tftpdir, "warewulf", "grub.efi")) + err = util.CopyFile(grubPath, path.Join(conf.TFTP.TftpRoot, "warewulf", "grub.efi")) if err != nil { return err } - _ = os.Chmod(path.Join(conf.Paths.Tftpdir, "warewulf", "grub.efi"), 0o755) - err = util.CopyFile(grubPath, path.Join(conf.Paths.Tftpdir, "warewulf", "grubx64.efi")) - _ = os.Chmod(path.Join(conf.Paths.Tftpdir, "warewulf", "grubx64.efi"), 0o755) + _ = os.Chmod(path.Join(conf.TFTP.TftpRoot, "warewulf", "grub.efi"), 0o755) + err = util.CopyFile(grubPath, path.Join(conf.TFTP.TftpRoot, "warewulf", "grubx64.efi")) + _ = os.Chmod(path.Join(conf.TFTP.TftpRoot, "warewulf", "grubx64.efi"), 0o755) return }