diff --git a/.gitignore b/.gitignore index 9bfa6313..e1845cba 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,7 @@ /wwctl /bash_completion /man_page + +# other created files +/usr/share/man/man1/ +/etc/bash_completion.d/ diff --git a/Makefile b/Makefile index 3903dab4..fb0fe542 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ SRC ?= main # auto installed tooling TOOLS_DIR := .tools TOOLS_BIN := $(TOOLS_DIR)/bin +CONFIG := $(shell pwd) # tools GO_TOOLS_BIN := $(addprefix $(TOOLS_BIN)/, $(notdir $(GO_TOOLS))) @@ -124,12 +125,16 @@ install_wwclient: wwclient $(foreach overlay, ${overlays}, install -D -m 0755 wwclient ${overlay}warewulf/bin/wwclient;) bash_completion: - cd cmd/bash_completion && go build -mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../bash_completion + cd cmd/bash_completion && go build -ldflags="-X 'github.com/hpcng/warewulf/internal/pkg/warewulfconf.ConfigFile=$(CONFIG)/etc/warewulf.conf'\ + -X 'github.com/hpcng/warewulf/internal/pkg/node.ConfigFile=$(CONFIG)/etc/nodes.conf'"\ + -mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../bash_completion install -d -m 0755 ./etc/bash_completion.d/ ./bash_completion ./etc/bash_completion.d/warewulf man_page: - cd cmd/man_page && go build -mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../man_page + cd cmd/man_page && go build -ldflags="-X 'github.com/hpcng/warewulf/internal/pkg/warewulfconf.ConfigFile=$(CONFIG)/etc/warewulf.conf'\ + -X 'github.com/hpcng/warewulf/internal/pkg/node.ConfigFile=$(CONFIG)/etc/nodes.conf'"\ + -mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../man_page install -d -m 0755 ./usr/share/man/man1 ./man_page ./usr/share/man/man1 gzip --force ./usr/share/man/man1/wwctl*1 diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index 27007dec..92c18107 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -3,14 +3,15 @@ package node import ( "errors" "fmt" - "github.com/hpcng/warewulf/internal/pkg/wwlog" - "gopkg.in/yaml.v2" "io/ioutil" "sort" "strings" + + "github.com/hpcng/warewulf/internal/pkg/wwlog" + "gopkg.in/yaml.v2" ) -const ConfigFile = "/etc/warewulf/nodes.conf" +var ConfigFile = "/etc/warewulf/nodes.conf" func New() (nodeYaml, error) { var ret nodeYaml diff --git a/internal/pkg/warewulfconf/datastructure.go b/internal/pkg/warewulfconf/datastructure.go index 8315ddd6..d47670ec 100644 --- a/internal/pkg/warewulfconf/datastructure.go +++ b/internal/pkg/warewulfconf/datastructure.go @@ -5,7 +5,7 @@ import ( "github.com/hpcng/warewulf/internal/pkg/wwlog" ) -const ConfigFile = "/etc/warewulf/warewulf.conf" +var ConfigFile = "/etc/warewulf/warewulf.conf" type ControllerConf struct { Comment string `yaml:"comment"`