make location of buildconf

This commit is contained in:
Christian Goll
2022-02-09 09:13:01 +01:00
parent 0c3de07d1e
commit 7b2d34f317
4 changed files with 14 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ SRVDIR ?= $(PREFIX)/srv
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(DATADIR)/man
LOCALSTATEDIR ?= $(PREFIX)/var
WWCLIENTLOC ?= /warewulf/bin
TFTPDIR ?= /var/lib/tftpboot
FIREWALLDDIR ?= /usr/lib/firewalld/services
@@ -98,6 +99,7 @@ config:
-e 's,@WWCHROOTDIR@,$(WWCHROOTDIR),g' \
-e 's,@WWPROVISIONDIR@,$(WWPROVISIONDIR),g' \
-e 's,@VERSION@,$(VERSION),g' \
-e 's,@WWCLIENTLOC@,$(WWCLIENTLOC),g' \
-e 's,@RELEASE@,$(RELEASE),g' $$i > $$NAME; \
done
touch config
@@ -181,7 +183,7 @@ wwclient:
-X 'github.com/hpcng/warewulf/internal/pkg/warewulfconf.ConfigFile=/etc/warewulf/warewulf.conf'" -o ../../wwclient
install_wwclient: wwclient
install -m 0755 wwclient $(DESTDIR)$(WWOVERLAYDIR)/wwinit/warewulf/bin/wwclient
install -m 0755 wwclient $(DESTDIR)$(WWOVERLAYDIR)/wwinit/$(WWCLIENTLOC)/wwclient
bash_completion:

View File

@@ -14,13 +14,14 @@ import (
"syscall"
"time"
"github.com/google/uuid"
"github.com/talos-systems/go-smbios/smbios"
"github.com/coreos/go-systemd/daemon"
"github.com/google/uuid"
"github.com/hpcng/warewulf/internal/pkg/buildconfig"
"github.com/hpcng/warewulf/internal/pkg/pidfile"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
"github.com/talos-systems/go-smbios/smbios"
)
var (
@@ -61,7 +62,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
return errors.New("found pidfile " + PIDFile + " not starting")
}
if os.Args[0] == "/warewulf/bin/wwclient" {
if os.Args[0] == buildconfig.WWCLIENTLOC() {
err := os.Chdir("/")
if err != nil {
wwlog.Printf(wwlog.ERROR, "failed to change dir: %s", err)
@@ -133,7 +134,6 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwid := strings.Split(wwid_tmp[1], " ")[0]
duration := 300
if conf.Warewulf.UpdateInterval > 0 {
duration = conf.Warewulf.UpdateInterval

View File

@@ -15,6 +15,7 @@ var (
wwprovisiondir string = "UNDEF"
version string = "UNDEF"
release string = "UNDEF"
wwclientloc string = "UNDEF"
)
func BINDIR() string {
@@ -76,3 +77,8 @@ func RELEASE() string {
wwlog.Printf(wwlog.DEBUG, "RELEASE = '%s'\n", release)
return release
}
func WWCLIENTLOC() string {
wwlog.Printf(wwlog.DEBUG, "WWCLIENTLOC = '%s'\n", wwclientloc)
return wwclientloc
}

View File

@@ -13,4 +13,5 @@ func init() {
wwprovisiondir = "@WWPROVISIONDIR@"
version = "@VERSION@"
release = "@RELEASE@"
wwclientloc = "@WWCLIENTLOC"
}