From 5d729f5cc475225d8db9aaab177b3e2355f3a089 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Mon, 15 Nov 2021 10:03:27 +0100 Subject: [PATCH 1/2] updated .gitignore to ignore man pages --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) 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/ From 74da63d079810296d2b1389204c07a5d27f461c8 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Thu, 18 Nov 2021 16:27:57 +0100 Subject: [PATCH 2/2] set .conf files for man_page and bash_completion --- Makefile | 9 +++++++-- internal/pkg/node/constructors.go | 7 ++++--- internal/pkg/warewulfconf/datastructure.go | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 66ff0636..d04f9d26 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ VERSION := 4.2.0 # auto installed tooling TOOLS_DIR := .tools TOOLS_BIN := $(TOOLS_DIR)/bin +CONFIG := $(shell pwd) # tools GO_TOOLS_BIN := $(addprefix $(TOOLS_BIN)/, $(notdir $(GO_TOOLS))) @@ -115,12 +116,16 @@ wwclient: cd cmd/wwclient; CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -ldflags '-extldflags -static' -o ../../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"`