do not export version and rc

create also a new warewulf.conf so that the compiled
in paths are in sync with the configuration

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2024-01-15 14:47:41 +01:00
committed by Jonathon Anderson
parent 24cb00e068
commit 5e94766895
4 changed files with 21 additions and 10 deletions

View File

@@ -106,7 +106,8 @@ install: build docs
install -d -m 0755 $(DESTDIR)$(SYSTEMDDIR) install -d -m 0755 $(DESTDIR)$(SYSTEMDDIR)
install -d -m 0755 $(DESTDIR)$(IPXESOURCE) install -d -m 0755 $(DESTDIR)$(IPXESOURCE)
install -d -m 0755 $(DESTDIR)$(DATADIR)/warewulf 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)/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)/wwapic.conf || install -m 0644 etc/wwapic.conf $(DESTDIR)$(WWCONFIGDIR)
test -f $(DESTDIR)$(WWCONFIGDIR)/wwapid.conf || install -m 0644 etc/wwapid.conf $(DESTDIR)$(WWCONFIGDIR) test -f $(DESTDIR)$(WWCONFIGDIR)/wwapid.conf || install -m 0644 etc/wwapid.conf $(DESTDIR)$(WWCONFIGDIR)

View File

@@ -13,10 +13,19 @@ type BuildConfig struct {
WWOverlaydir string `default:"@WWOVERLAYDIR@"` WWOverlaydir string `default:"@WWOVERLAYDIR@"`
WWChrootdir string `default:"@WWCHROOTDIR@"` WWChrootdir string `default:"@WWCHROOTDIR@"`
WWProvisiondir string `default:"@WWPROVISIONDIR@"` WWProvisiondir string `default:"@WWPROVISIONDIR@"`
Version string `default:"@VERSION@"`
Release string `default:"@RELEASE@"`
WWClientdir string `default:"@WWCLIENTDIR@"` 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 { type TFTPConf struct {
Enabled bool `yaml:"enabled" default:"true"` Enabled bool `yaml:"enabled" default:"true"`
TftpRoot string `yaml:"tftproot" default:"@TFTPDIR@"` 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\"}"` 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 // WarewulfConf adds additional Warewulf-specific configuration to
// BaseConf. // BaseConf.
type WarewulfConf struct { type WarewulfConf struct {

View File

@@ -12,7 +12,7 @@ Return the version of wwctl
*/ */
func GetVersion() string { func GetVersion() string {
conf := warewulfconf.Get() 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())
} }
/* /*

View File

@@ -24,22 +24,22 @@ func CopyShimGrub() (err error) {
if shimPath == "" { if shimPath == "" {
return fmt.Errorf("no shim found on the host os") 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 { if err != nil {
return err 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("") grubPath := container.GrubFind("")
if grubPath == "" { if grubPath == "" {
return fmt.Errorf("no grub found on host os") 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 { if err != nil {
return err return err
} }
_ = os.Chmod(path.Join(conf.Paths.Tftpdir, "warewulf", "grub.efi"), 0o755) _ = os.Chmod(path.Join(conf.TFTP.TftpRoot, "warewulf", "grub.efi"), 0o755)
err = util.CopyFile(grubPath, path.Join(conf.Paths.Tftpdir, "warewulf", "grubx64.efi")) err = util.CopyFile(grubPath, path.Join(conf.TFTP.TftpRoot, "warewulf", "grubx64.efi"))
_ = os.Chmod(path.Join(conf.Paths.Tftpdir, "warewulf", "grubx64.efi"), 0o755) _ = os.Chmod(path.Join(conf.TFTP.TftpRoot, "warewulf", "grubx64.efi"), 0o755)
return return
} }