added wwctl genconf used to generate completions

Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
Christian Goll
2023-03-01 16:42:58 +01:00
parent 2c9a241643
commit ab2139a1fd
5 changed files with 86 additions and 17 deletions

View File

@@ -88,6 +88,11 @@ GO_TOOLS_VENDOR := $(addprefix vendor/, $(GO_TOOLS))
GOLANGCI_LINT := $(TOOLS_BIN)/golangci-lint
GOLANGCI_LINT_VERSION := v1.50.0
# helper functions
godeps=$(shell go list -deps -f '{{if not .Standard}}{{ $$dep := . }}{{range .GoFiles}}{{$$dep.Dir}}/{{.}} {{end}}{{end}}' $(1) | sed "s%${PWD}/%%g")
WWCTL_DEPS:=$(call godeps,cmd/wwctl/main.go)
WWCLIENT_DEPS:=$(call godeps,cmd/wwclient/main.go)
# use GOPROXY for older git clients and speed up downloads
GOPROXY ?= https://proxy.golang.org
export GOPROXY
@@ -96,7 +101,7 @@ export GOPROXY
WW_GO_BUILD_TAGS := containers_image_openpgp containers_image_ostree
# Default target
all: config vendor wwctl wwclient bash_completion.d man_pages config_defaults print_defaults wwapid wwapic wwapird print_mnts
all: config vendor wwctl wwclient man_pages config_defaults print_defaults wwapid wwapic wwapird print_mnts
# Validate source and build all packages
build: lint test-it vet all
@@ -197,7 +202,7 @@ files: all
install -m 0644 include/firewalld/warewulf.xml $(DESTDIR)$(FIREWALLDDIR)
install -m 0644 include/systemd/warewulfd.service $(DESTDIR)$(SYSTEMDDIR)
install -m 0644 LICENSE.md $(DESTDIR)$(WWDOCDIR)
cp bash_completion.d/warewulf $(DESTDIR)$(BASHCOMPDIR)
./wwctl genconf completions > $(DESTDIR)$(BASHCOMPDIR)/wwctl
cp man_pages/*.1* $(DESTDIR)$(MANDIR)/man1/
cp man_pages/*.5* $(DESTDIR)$(MANDIR)/man5/
install -m 0644 staticfiles/README-ipxe.md $(DESTDIR)$(WWDATADIR)/ipxe
@@ -210,25 +215,18 @@ init:
cp -r tftpboot/* $(WWTFTPDIR)/ipxe/
restorecon -r $(WWTFTPDIR)
wwctl:
cd cmd/wwctl; GOOS=linux go build -mod vendor -tags "$(WW_GO_BUILD_TAGS)" -o ../../wwctl
wwctl: $(WWCTL_DEPS)
@echo Building "$@"
@cd cmd/wwctl; GOOS=linux go build -mod vendor -tags "$(WW_GO_BUILD_TAGS)" -o ../../wwctl
wwclient:
cd cmd/wwclient; CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -ldflags "-extldflags -static \
wwclient: $(WWCLIENT_DEPS)
@echo Building "$@"
@ cd cmd/wwclient; CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -ldflags "-extldflags -static \
-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/$(WWCLIENTDIR)/wwclient
bash_completion:
cd cmd/bash_completion && go build -ldflags="-X 'github.com/hpcng/warewulf/internal/pkg/warewulfconf.ConfigFile=./etc/warewulf.conf'\
-X 'github.com/hpcng/warewulf/internal/pkg/node.ConfigFile=./etc/nodes.conf'"\
-mod vendor -tags "$(WW_GO_BUILD_TAGS)" -o ../../bash_completion
bash_completion.d: bash_completion
install -d -m 0755 bash_completion.d
./bash_completion bash_completion.d/warewulf
man_page:
cd cmd/man_page && go build -ldflags="-X 'github.com/hpcng/warewulf/internal/pkg/warewulfconf.ConfigFile=./etc/warewulf.conf'\
-X 'github.com/hpcng/warewulf/internal/pkg/node.ConfigFile=./etc/nodes.conf'"\
@@ -297,8 +295,6 @@ contclean:
rm -f wwctl
rm -rf .dist
rm -f $(WAREWULF)-$(VERSION).tar.gz
rm -f bash_completion
rm -rf bash_completion.d
rm -f man_page
rm -rf man_pages
rm -f warewulf.spec