Updates specfile to match distro guidelines. Suppots modifying client directory path at build time.
- Support relocating client files at build time (required for LSB compliant nodes) - OS varable added to perform some make choices - Saving and exporting the Makefile vars now scripted using list of variables - Updated specfile to match RH and SUSE requirements and guidelines - Moved /usr/local/var to /var/local; dynamic files shall not use /usr. - State files use %sharedstatedir for path (std for SLE and RHEL) - Release value adjusted to meet different DEB and RPM reqs. Signed-off-by: jcsiadal <jeremy.c.siadal@intel.com>
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
VERSION ?= @VERSION@
|
||||
RELEASE ?= @RELEASE@
|
||||
PREFIX ?= @PREFIX@
|
||||
BINDIR ?= @BINDIR@
|
||||
SYSCONFDIR ?= @SYSCONFDIR@
|
||||
SRVDIR ?= @SRVDIR@
|
||||
DATADIR ?= @DATADIR@
|
||||
MANDIR ?= @MANDIR@
|
||||
LOCALSTATEDIR ?= @LOCALSTATEDIR@
|
||||
TFTPDIR ?= @TFTPDIR@
|
||||
FIREWALLDDIR ?= @FIREWALLDDIR@
|
||||
SYSTEMDDIR ?= @SYSTEMDDIR@
|
||||
BASH_COMPLETION ?= @BASH_COMPLETION@
|
||||
165
Makefile
165
Makefile
@@ -1,39 +1,69 @@
|
||||
.PHONY: all
|
||||
|
||||
# Linux distro (set to /etc/os-release ID)
|
||||
OS ?= rocky
|
||||
|
||||
# List of variables to save or replace in files
|
||||
VARLIST := OS
|
||||
|
||||
-include Defaults.mk
|
||||
|
||||
# Project Information
|
||||
VARLIST += WAREWULF VERSION RELEASE
|
||||
WAREWULF ?= warewulf
|
||||
VERSION ?= 4.2.0
|
||||
GIT_TAG := $(shell test -e .git && git describe --tags --long --first-parent --always)
|
||||
|
||||
ifndef $(GIT_TAG)
|
||||
RELEASE ?= 1.git_$(GIT_TAG)
|
||||
ifdef $(filter $(OS),ubuntu debian)
|
||||
RELEASE ?= 1.git_$(subst -,+,$(GIT_TAG))
|
||||
else
|
||||
RELEASE ?= 1.git_$(subst -,_,$(GIT_TAG))
|
||||
endif
|
||||
else
|
||||
RELEASE ?= 1
|
||||
RELEASE ?= 1
|
||||
endif
|
||||
|
||||
# System locations
|
||||
# System directory paths
|
||||
VARLIST += PREFIX BINDIR SYSCONFDIR SRVDIR DATADIR MANDIR DOCDIR LOCALSTATEDIR SHAREDSTATEDIR
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
SYSCONFDIR ?= $(PREFIX)/etc
|
||||
SRVDIR ?= $(PREFIX)/srv
|
||||
SRVDIR ?= /srv
|
||||
DATADIR ?= $(PREFIX)/share
|
||||
MANDIR ?= $(DATADIR)/man
|
||||
<<<<<<< HEAD
|
||||
LOCALSTATEDIR ?= $(PREFIX)/var
|
||||
WWCLIENTLOC ?= /warewulf/bin
|
||||
|
||||
=======
|
||||
DOCDIR ?= $(DATADIR)/doc
|
||||
LOCALSTATEDIR ?= /var
|
||||
SHAREDSTATEDIR ?= /var/local
|
||||
|
||||
# OS-Specific Service Locations
|
||||
VARLIST += TFTPDIR FIREWALLDDIR SYSTEMDDIR
|
||||
ifeq ($(OS),suse)
|
||||
TFTPDIR ?= /srv/tftpboot
|
||||
endif
|
||||
ifeq ($(OS),ubuntu)
|
||||
TFTPDIR ?= /srv/tftp
|
||||
endif
|
||||
>>>>>>> 7b0a40a... Updates specfile to match distro guidelines. Suppots modifying client directory path at build time.
|
||||
TFTPDIR ?= /var/lib/tftpboot
|
||||
FIREWALLDDIR ?= /usr/lib/firewalld/services
|
||||
SYSTEMDDIR ?= /usr/lib/systemd/system
|
||||
BASH_COMPLETION ?= /etc/bash_completion.d/
|
||||
BASHCOMPDIR ?= /etc/bash_completion.d
|
||||
|
||||
# Warewulf locations
|
||||
WWPROVISIONDIR = $(SRVDIR)/warewulf
|
||||
WWOVERLAYDIR = $(LOCALSTATEDIR)/warewulf/overlays
|
||||
WWCHROOTDIR = $(LOCALSTATEDIR)/warewulf/chroots
|
||||
|
||||
# SuSE
|
||||
#TFTPDIR ?= /srv/tftpboot
|
||||
#FIREWALLDIR ?= /srv/tftp
|
||||
# Warewulf directory paths
|
||||
VARLIST += WWCLIENTDIR WWCONFIGDIR WWPROVISIONDIR WWOVERLAYDIR WWCHROOTDIR WWTFTPDIR WWDOCDIR
|
||||
WWCONFIGDIR := $(SYSCONFDIR)/$(WAREWULF)
|
||||
WWPROVISIONDIR := $(SHAREDSTATEDIR)/$(WAREWULF)
|
||||
WWOVERLAYDIR := $(SHAREDSTATEDIR)/$(WAREWULF)/overlays
|
||||
WWCHROOTDIR := $(SHAREDSTATEDIR)/$(WAREWULF)/chroots
|
||||
WWTFTPDIR := $(TFTPDIR)/$(WAREWULF)
|
||||
WWDOCDIR := $(DOCDIR)/$(WAREWULF)
|
||||
WWCLIENTDIR ?= /warewulf
|
||||
|
||||
# auto installed tooling
|
||||
TOOLS_DIR := .tools
|
||||
@@ -51,7 +81,7 @@ GOPROXY ?= https://proxy.golang.org
|
||||
export GOPROXY
|
||||
|
||||
# built tags needed for wwbuild binary
|
||||
WW_BUILD_GO_BUILD_TAGS := containers_image_openpgp containers_image_ostree
|
||||
WW_GO_BUILD_TAGS := containers_image_openpgp containers_image_ostree
|
||||
|
||||
all: config vendor wwctl wwclient bash_completion.d man_pages
|
||||
|
||||
@@ -68,10 +98,8 @@ $(GO_TOOLS_BIN):
|
||||
$(GOLANGCI_LINT):
|
||||
@curl -qq -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN) $(GOLANGCI_LINT_VERSION)
|
||||
|
||||
|
||||
setup: vendor $(TOOLS_DIR) setup_tools
|
||||
|
||||
# vendor
|
||||
vendor:
|
||||
go mod tidy -v
|
||||
go mod vendor
|
||||
@@ -81,27 +109,11 @@ $(TOOLS_DIR):
|
||||
|
||||
# Pre-build steps for source, such as "go generate"
|
||||
config:
|
||||
set -x ;\
|
||||
for i in `find . -type f -name "*.in" -not -path "./vendor/*"`; do \
|
||||
NAME=`echo $$i | sed -e 's,\.in,,'`; \
|
||||
sed -e 's,@BINDIR@,$(BINDIR),g' \
|
||||
-e 's,@SYSCONFDIR@,$(SYSCONFDIR),g' \
|
||||
-e 's,@LOCALSTATEDIR@,$(LOCALSTATEDIR),g' \
|
||||
-e 's,@PREFIX@,$(PREFIX),g' \
|
||||
-e 's,@DATADIR@,$(DATADIR),g' \
|
||||
-e 's,@MANDIR@,$(MANDIR),g' \
|
||||
-e 's,@SRVDIR@,$(SRVDIR),g' \
|
||||
-e 's,@TFTPDIR@,$(TFTPDIR),g' \
|
||||
-e 's,@FIREWALLDDIR@,$(FIREWALLDDIR),g' \
|
||||
-e 's,@SYSTEMDDIR@,$(SYSTEMDDIR),g' \
|
||||
-e 's,@BASH_COMPLETION@,$(BASH_COMPLETION),g' \
|
||||
-e 's,@WWOVERLAYDIR@,$(WWOVERLAYDIR),g' \
|
||||
-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
|
||||
# Store configuration for subsequent runs
|
||||
printf " $(foreach V,$(VARLIST),$V := $(strip $($V))\n)" > Defaults.mk
|
||||
# Global variable search and replace for all *.in files
|
||||
find . -type f -name "*.in" -not -path "./vendor/*" \
|
||||
-exec sh -c 'sed -ne "$(foreach V,$(VARLIST),s,@$V@,$(strip $($V)),g;)p" $${0} > $${0%.in}' {} \;
|
||||
touch config
|
||||
|
||||
rm_config:
|
||||
@@ -109,11 +121,10 @@ rm_config:
|
||||
|
||||
genconfig: rm_config config
|
||||
|
||||
|
||||
# Lint
|
||||
lint: setup_tools
|
||||
@echo Running golangci-lint...
|
||||
@$(GOLANGCI_LINT) run --build-tags "$(WW_BUILD_GO_BUILD_TAGS)" --skip-dirs internal/pkg/staticfiles ./...
|
||||
@$(GOLANGCI_LINT) run --build-tags "$(WW_GO_BUILD_TAGS)" --skip-dirs internal/pkg/staticfiles ./...
|
||||
|
||||
vet:
|
||||
go vet ./...
|
||||
@@ -137,98 +148,86 @@ files: all
|
||||
install -d -m 0755 $(DESTDIR)$(BINDIR)
|
||||
install -d -m 0755 $(DESTDIR)$(WWCHROOTDIR)
|
||||
install -d -m 0755 $(DESTDIR)$(WWPROVISIONDIR)
|
||||
install -d -m 0755 $(DESTDIR)$(WWOVERLAYDIR)
|
||||
install -d -m 0755 $(DESTDIR)$(WWOVERLAYDIR)/wwinit/warewulf/bin/
|
||||
install -d -m 0755 $(DESTDIR)$(SYSCONFDIR)/warewulf/
|
||||
install -d -m 0755 $(DESTDIR)$(SYSCONFDIR)/warewulf/ipxe
|
||||
install -d -m 0755 $(DESTDIR)$(TFTPDIR)/warewulf/ipxe/
|
||||
install -d -m 0755 $(DESTDIR)$(BASH_COMPLETION)
|
||||
install -d -m 0755 $(DESTDIR)$(WWOVERLAYDIR)/wwinit/$(WWCLIENTDIR)
|
||||
install -d -m 0755 $(DESTDIR)$(WWCONFIGDIR)/ipxe
|
||||
install -d -m 0755 $(DESTDIR)$(WWTFTPDIR)/ipxe/
|
||||
install -d -m 0755 $(DESTDIR)$(BASHCOMPDIR)
|
||||
install -d -m 0755 $(DESTDIR)$(MANDIR)/man1
|
||||
install -d -m 0755 $(DESTDIR)$(WWDOCDIR)
|
||||
install -d -m 0755 $(DESTDIR)$(FIREWALLDDIR)
|
||||
install -d -m 0755 $(DESTDIR)$(SYSTEMDDIR)
|
||||
test -f $(DESTDIR)$(SYSCONFDIR)/warewulf/warewulf.conf || install -m 644 etc/warewulf.conf $(DESTDIR)$(SYSCONFDIR)/warewulf/
|
||||
test -f $(DESTDIR)$(SYSCONFDIR)/warewulf/hosts.tmpl || install -m 644 etc/hosts.tmpl $(DESTDIR)$(SYSCONFDIR)/warewulf/
|
||||
test -f $(DESTDIR)$(SYSCONFDIR)/warewulf/nodes.conf || install -m 644 etc/nodes.conf $(DESTDIR)$(SYSCONFDIR)/warewulf/
|
||||
cp -r etc/dhcp $(DESTDIR)$(SYSCONFDIR)/warewulf/
|
||||
cp -r etc/ipxe $(DESTDIR)$(SYSCONFDIR)/warewulf/
|
||||
cp -r overlays/* $(DESTDIR)$(WWOVERLAYDIR)/
|
||||
test -f $(DESTDIR)$(WWCONFIGDIR)/warewulf.conf || install -m 644 etc/warewulf.conf $(DESTDIR)$(WWCONFIGDIR)
|
||||
test -f $(DESTDIR)$(WWCONFIGDIR)/hosts.tmpl || install -m 644 etc/hosts.tmpl $(DESTDIR)$(WWCONFIGDIR)
|
||||
test -f $(DESTDIR)$(WWCONFIGDIR)/nodes.conf || install -m 644 etc/nodes.conf $(DESTDIR)$(WWCONFIGDIR)
|
||||
cp -r etc/dhcp $(DESTDIR)$(WWCONFIGDIR)/
|
||||
cp -r etc/ipxe $(DESTDIR)$(WWCONFIGDIR)/
|
||||
cp -r overlays/wwinit $(DESTDIR)$(WWOVERLAYDIR)/
|
||||
cp -r overlays/generic $(DESTDIR)$(WWOVERLAYDIR)/
|
||||
cp -r overlays/wwclient/* $(DESTDIR)$(WWOVERLAYDIR)/wwinit/$(WWCLIENTDIR)/
|
||||
chmod 755 $(DESTDIR)$(WWOVERLAYDIR)/wwinit/init
|
||||
chmod 755 $(DESTDIR)$(WWOVERLAYDIR)/wwinit/warewulf/wwinit
|
||||
rm -f $(DESTDIR)$(WWOVERLAYDIR)/wwinit/init.in
|
||||
find $(DESTDIR)$(WWOVERLAYDIR) -type f -name "*.in" -exec rm -f {} \;
|
||||
chmod 755 $(DESTDIR)$(WWOVERLAYDIR)/wwinit/$(WWCLIENTDIR)/wwinit
|
||||
chmod 600 $(DESTDIR)$(WWOVERLAYDIR)/wwinit/etc/ssh/ssh*
|
||||
chmod 644 $(DESTDIR)$(WWOVERLAYDIR)/wwinit/etc/ssh/ssh*.pub.ww
|
||||
install -m 0755 wwctl $(DESTDIR)$(BINDIR)
|
||||
install -c -m 0644 include/firewalld/warewulf.xml $(DESTDIR)$(FIREWALLDDIR)
|
||||
install -c -m 0644 include/systemd/warewulfd.service $(DESTDIR)$(SYSTEMDDIR)
|
||||
cp bash_completion.d/warewulf $(DESTDIR)$(BASH_COMPLETION)
|
||||
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)
|
||||
cp man_pages/* $(DESTDIR)$(MANDIR)/man1/
|
||||
|
||||
init:
|
||||
systemctl daemon-reload
|
||||
cp -r tftpboot/* $(TFTPDIR)/warewulf/ipxe/
|
||||
restorecon -r $(TFTPDIR)/warewulf
|
||||
|
||||
# Overlay file system has changed
|
||||
#debfiles: debian
|
||||
# chmod +x $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/init
|
||||
# chmod 600 $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/etc/ssh/ssh*
|
||||
# chmod 644 $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/etc/ssh/ssh*.pub.ww
|
||||
# mkdir -p $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/warewulf/bin/
|
||||
# cp wwclient $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/warewulf/bin/
|
||||
cp -r tftpboot/* $(WWTFTPDIR)/ipxe/
|
||||
restorecon -r $(WWTFTPDIR)
|
||||
|
||||
wwctl:
|
||||
cd cmd/wwctl; GOOS=linux go build -mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../wwctl
|
||||
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 \
|
||||
-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/$(WWCLIENTLOC)/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_BUILD_GO_BUILD_TAGS)" -o ../../bash_completion
|
||||
-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
|
||||
./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'"\
|
||||
-mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../man_page
|
||||
-mod vendor -tags "$(WW_GO_BUILD_TAGS)" -o ../../man_page
|
||||
|
||||
man_pages: man_page
|
||||
install -d man_pages
|
||||
./man_page ./man_pages
|
||||
cd man_pages; for i in wwctl*1; do echo "Compressing manpage: $$i"; gzip --force $$i; done
|
||||
|
||||
#config_defaults:
|
||||
# cd cmd/config_defaults && 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' \
|
||||
# -X 'github.com/hpcng/warewulf/internal/pkg/warewulfconf.defaultDataStore=$(WWROOT)/warewulf'" \
|
||||
# -mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../config_defaults
|
||||
|
||||
dist: vendor config
|
||||
rm -rf .dist/warewulf-$(VERSION)
|
||||
mkdir -p .dist/warewulf-$(VERSION)
|
||||
cp -rap * .dist/warewulf-$(VERSION)/
|
||||
cd .dist; tar -czf ../warewulf-$(VERSION).tar.gz warewulf-$(VERSION)
|
||||
rm -rf .dist/$(WAREWULF)-$(VERSION)
|
||||
mkdir -p .dist/$(WAREWULF)-$(VERSION)
|
||||
cp -rap * .dist/$(WAREWULF)-$(VERSION)/
|
||||
cd .dist; tar -czf ../$(WAREWULF)-$(VERSION).tar.gz $(WAREWULF)-$(VERSION)
|
||||
rm -rf .dist
|
||||
|
||||
clean:
|
||||
rm -f wwclient
|
||||
rm -f wwctl
|
||||
rm -rf .dist
|
||||
rm -f warewulf-$(VERSION).tar.gz
|
||||
rm -f $(WAREWULF)-$(VERSION).tar.gz
|
||||
rm -f bash_completion
|
||||
rm -rf bash_completion.d
|
||||
rm -f man_page
|
||||
rm -rf man_pages
|
||||
rm -rf vendor
|
||||
# rm -f config_defaults
|
||||
rm -f config
|
||||
rm -f Defaults.mk
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"path"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
@@ -62,7 +63,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
return errors.New("found pidfile " + PIDFile + " not starting")
|
||||
}
|
||||
|
||||
if os.Args[0] == buildconfig.WWCLIENTLOC() {
|
||||
clientDir := buildconfig.WWCLIENTDIR()
|
||||
testDir := path.Join(clientDir, "wwclient-test")
|
||||
|
||||
if os.Args[0] == path.Join(clientDir, "wwclient") {
|
||||
err := os.Chdir("/")
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "failed to change dir: %s", err)
|
||||
@@ -73,15 +77,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
time.Sleep(5000 * time.Millisecond)
|
||||
} else {
|
||||
fmt.Printf("Called via: %s\n", os.Args[0])
|
||||
fmt.Printf("Runtime overlay is being put in '/warewulf/wwclient-test' rather than '/'\n")
|
||||
err := os.MkdirAll("/warewulf/wwclient-test", 0755)
|
||||
fmt.Printf("Runtime overlay is being put in '%s' rather than '/'\n", testDir)
|
||||
err := os.MkdirAll(testDir, 0755)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "failed to create dir: %s", err)
|
||||
_ = os.Remove(PIDFile)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = os.Chdir("/warewulf/wwclient-test")
|
||||
err = os.Chdir(testDir)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "failed to change dir: %s", err)
|
||||
_ = os.Remove(PIDFile)
|
||||
|
||||
@@ -6,6 +6,7 @@ var (
|
||||
bindir string = "UNDEF"
|
||||
sysconfdir string = "UNDEF"
|
||||
localstatedir string = "UNDEF"
|
||||
sharedstatedir string = "UNDEF"
|
||||
srvdir string = "UNDEF"
|
||||
tftpdir string = "UNDEF"
|
||||
firewallddir string = "UNDEF"
|
||||
@@ -13,6 +14,7 @@ var (
|
||||
wwoverlaydir string = "UNDEF"
|
||||
wwchrootdir string = "UNDEF"
|
||||
wwprovisiondir string = "UNDEF"
|
||||
wwclientdir string = "UNDEF"
|
||||
version string = "UNDEF"
|
||||
release string = "UNDEF"
|
||||
wwclientloc string = "UNDEF"
|
||||
@@ -78,7 +80,12 @@ func RELEASE() string {
|
||||
return release
|
||||
}
|
||||
|
||||
func WWCLIENTLOC() string {
|
||||
wwlog.Printf(wwlog.DEBUG, "WWCLIENTLOC = '%s'\n", wwclientloc)
|
||||
return wwclientloc
|
||||
func WWCLIENTDIR() string {
|
||||
wwlog.Printf(wwlog.DEBUG, "WWPROVISIONDIR = '%s'\n", wwclientdir)
|
||||
return wwclientdir
|
||||
}
|
||||
|
||||
func SHAREDSTATEDIR() string {
|
||||
wwlog.Printf(wwlog.DEBUG, "SHAREDSTATEDIR = '%s'\n", sharedstatedir)
|
||||
return sharedstatedir
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ func init() {
|
||||
bindir = "@BINDIR@"
|
||||
sysconfdir = "@SYSCONFDIR@"
|
||||
localstatedir = "@LOCALSTATEDIR@"
|
||||
sharedstatedir = "@SHAREDSTATEDIR@"
|
||||
srvdir = "@SRVDIR@"
|
||||
tftpdir = "@TFTPDIR@"
|
||||
firewallddir = "@FIREWALLDDIR@"
|
||||
@@ -11,6 +12,7 @@ func init() {
|
||||
wwoverlaydir = "@WWOVERLAYDIR@"
|
||||
wwchrootdir = "@WWCHROOTDIR@"
|
||||
wwprovisiondir = "@WWPROVISIONDIR@"
|
||||
wwclientdir = "@WWCLIENTDIR@"
|
||||
version = "@VERSION@"
|
||||
release = "@RELEASE@"
|
||||
wwclientloc = "@WWCLIENTLOC"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /warewulf/config
|
||||
. @WWCLIENTDIR@/config
|
||||
|
||||
echo "Bringing up lo:127.0.0.1"
|
||||
/sbin/ip link set dev lo up
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /warewulf/config
|
||||
. @WWCLIENTDIR@/config
|
||||
|
||||
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /warewulf/config
|
||||
. @WWCLIENTDIR@/config
|
||||
|
||||
# This will eventually be optional
|
||||
if true; then
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /warewulf/config
|
||||
. @WWCLIENTDIR@/config
|
||||
# Only start if the systemd is no available
|
||||
test -e /usr/lib/systemd/systemd && exit 0
|
||||
echo "Starting wwclient"
|
||||
nohup /warewulf/bin/wwclient >/var/log/wwclient.log 2>&1 </dev/null &
|
||||
nohup @WWCLIENTDIR@/wwclient >/var/log/wwclient.log 2>&1 </dev/null &
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /warewulf/config
|
||||
. @WWCLIENTDIR@/config
|
||||
|
||||
if test -z "$WWROOT"; then
|
||||
echo "Skipping SELinux configuration: Warewulf Root device not set"
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
echo "Hello from WWINIT"
|
||||
|
||||
. /warewulf/config
|
||||
. @WWCLIENTDIR@/config
|
||||
|
||||
for i in /warewulf/init.d/*; do
|
||||
for i in @WWCLIENTDIR@/init.d/*; do
|
||||
NAME=`basename $i`
|
||||
echo "Launching: $NAME"
|
||||
sh "$i"
|
||||
@@ -5,7 +5,7 @@ After=local-fs.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=/warewulf/bin/wwclient
|
||||
ExecStart=@WWCLIENTDIR@/wwclient
|
||||
ExecReload=/bin/kill -s SIGHUP "$MAINPID"
|
||||
PIDFile=/var/run/wwclient.pid
|
||||
TimeoutSec=60
|
||||
@@ -6,8 +6,8 @@
|
||||
# Edit at your own risk! DANGER DANGER.
|
||||
|
||||
|
||||
if test -f "/warewulf/config"; then
|
||||
. /warewulf/config
|
||||
if test -f "@WWCLIENTDIR@/config"; then
|
||||
. @WWCLIENTDIR@/config
|
||||
else
|
||||
echo "ERROR: Warewulf configuration file not found... rebooting in 1 minute"
|
||||
sleep 60
|
||||
@@ -24,7 +24,7 @@ mount -t devtmpfs devtmpfs /dev
|
||||
mount -t sysfs sysfs /sys
|
||||
mount -t tmpfs tmpfs /run
|
||||
|
||||
chmod 755 /warewulf/wwinit
|
||||
chmod 755 @WWCLIENTDIR@/wwinit
|
||||
|
||||
echo "Checking Rootfs type"
|
||||
ROOTFSTYPE=`stat -f -c "%T" /`
|
||||
@@ -32,7 +32,7 @@ ROOTFSTYPE=`stat -f -c "%T" /`
|
||||
if test "$WWROOT" = "initramfs"; then
|
||||
echo "Provisioned to default initramfs file system: $ROOTFSTYPE"
|
||||
echo "Calling WW Init"
|
||||
exec /warewulf/wwinit
|
||||
exec @WWCLIENTDIR@/wwinit
|
||||
elif test "$WWROOT" = "tmpfs"; then
|
||||
if test "$ROOTFSTYPE" = "tmpfs"; then
|
||||
echo "ERROR: Switching the root file system requires the kernel argument: 'rootfstype=ramfs'"
|
||||
@@ -44,7 +44,7 @@ elif test "$WWROOT" = "tmpfs"; then
|
||||
tar -cf - --exclude ./proc --exclude ./sys --exclude ./dev --exclude ./newroot . | tar -xf - -C /newroot
|
||||
mkdir /newroot/proc /newroot/dev /newroot/sys /newroot/run 2>/dev/null
|
||||
echo "Calling switch_root and invoking WW Init"
|
||||
exec /sbin/switch_root /newroot /warewulf/wwinit
|
||||
exec /sbin/switch_root /newroot @WWCLIENTDIR@/wwinit
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Unknown Warewulf Root file system: $WWROOT"
|
||||
@@ -1,13 +1,16 @@
|
||||
%global wwgroup warewulf
|
||||
%if 0%{?sle_version}
|
||||
%global tftpdir "/srv/tftpboot"
|
||||
%global srvdir "/srv"
|
||||
%else
|
||||
%global tftpdir "/var/lib/tftpboot"
|
||||
%global srvdir "%{_localstatedir}/warewulf/srv"
|
||||
%endif
|
||||
%define debug_package %{nil}
|
||||
|
||||
%if 0%{?sle_version}
|
||||
%global tftpdir /srv/tftpboot
|
||||
%global srvdir /srv
|
||||
%else
|
||||
# Assume Fedora-based OS if not SUSE-based
|
||||
%global tftpdir /var/lib/tftpboot
|
||||
%global srvdir %{_sharedstatedir}
|
||||
%endif
|
||||
|
||||
%global wwgroup warewulf
|
||||
|
||||
Name: warewulf
|
||||
Summary: A provisioning system for large clusters of bare metal and/or virtual systems
|
||||
Version: @VERSION@
|
||||
@@ -27,17 +30,18 @@ Conflicts: warewulf-ipmi
|
||||
|
||||
BuildRequires: make
|
||||
|
||||
%if 0%{?rhel}
|
||||
BuildRequires: systemd
|
||||
BuildRequires: golang
|
||||
Requires: tftp-server
|
||||
Requires: nfs-utils
|
||||
%else
|
||||
# sle_version
|
||||
%if 0%{?sle_version}
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: go
|
||||
BuildRequires: firewall-macros
|
||||
Requires: tftp
|
||||
Requires: nfs-kernel-server
|
||||
%else
|
||||
BuildRequires: systemd
|
||||
BuildRequires: golang
|
||||
BuildRequires: firewalld-filesystem
|
||||
Requires: tftp-server
|
||||
Requires: nfs-utils
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} >= 8 || 0%{?sle_version}
|
||||
@@ -57,30 +61,36 @@ system for large clusters of bare metal and/or virtual systems.
|
||||
|
||||
|
||||
%build
|
||||
make genconfig PREFIX=/usr \
|
||||
SRVDIR=%{srvdir} \
|
||||
LOCALSTATEDIR=%{_localstatedir} \
|
||||
make genconfig \
|
||||
PREFIX=%{_prefix} \
|
||||
BINDIR=%{_bindir} \
|
||||
SYSCONFDIR=%{_sysconfdir} \
|
||||
DATADIR=%{_datadir} \
|
||||
LOCALSTATEDIR=%{_localstatedir} \
|
||||
SHAREDSTATEDIR=%{_sharedstatedir} \
|
||||
MANDIR=%{_mandir} \
|
||||
BINDIR=%{_bindir} \
|
||||
INFODIR=%{_infodir} \
|
||||
DOCDIR=%{_docdir} \
|
||||
SRVDIR=%{srvdir} \
|
||||
TFTPDIR=%{tftpdir} \
|
||||
SYSTEMDDIR=%{_unitdir} \
|
||||
MANDIR=%{_mandir} \
|
||||
BASH_COMPLETION=/etc/bash_completion.d/ \
|
||||
FIREWALLDDIR=/usr/lib/firewalld/services
|
||||
|
||||
BASHCOMPDIR=/etc/bash_completion.d/ \
|
||||
FIREWALLDDIR=/usr/lib/firewalld/services \
|
||||
WWCLIENTDIR=%{_libexecdir}/warewulf
|
||||
make
|
||||
|
||||
|
||||
%install
|
||||
make install DESTDIR=%{buildroot}
|
||||
|
||||
|
||||
%pre
|
||||
getent group %{wwgroup} >/dev/null || groupadd -r %{wwgroup}
|
||||
|
||||
|
||||
%post
|
||||
%systemd_post warewulfd.service
|
||||
%firewalld_reload
|
||||
|
||||
|
||||
%preun
|
||||
@@ -89,26 +99,34 @@ getent group %{wwgroup} >/dev/null || groupadd -r %{wwgroup}
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart warewulfd.service
|
||||
%firewalld_reload
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-, root, %{wwgroup})
|
||||
%dir %{_sysconfdir}/%{name}
|
||||
%config(noreplace) %{_sysconfdir}/%{name}/*
|
||||
%config(noreplace) %attr(0640,-,-) %{_sysconfdir}/%{name}/nodes.conf
|
||||
%dir %{_sysconfdir}/warewulf
|
||||
%config(noreplace) %{_sysconfdir}/warewulf/*
|
||||
%config(noreplace) %attr(0640,-,-) %{_sysconfdir}/warewulf/nodes.conf
|
||||
%{_sysconfdir}/bash_completion.d/warewulf
|
||||
|
||||
%dir %{_localstatedir}/warewulf
|
||||
%{_localstatedir}/warewulf/chroots
|
||||
%{_localstatedir}/warewulf/overlays
|
||||
%{srvdir}
|
||||
%dir %{_sharedstatedir}/warewulf
|
||||
%{_sharedstatedir}/warewulf/chroots
|
||||
%{_sharedstatedir}/warewulf/overlays
|
||||
%{srvdir}/warewulf
|
||||
|
||||
%attr(-, root, root) %{_bindir}/wwctl
|
||||
%attr(-, root, root) %{_prefix}/lib/firewalld/services/warewulf.xml
|
||||
%attr(-, root, root) %{_unitdir}/warewulfd.service
|
||||
%attr(-, root, root) %{_mandir}/man1/wwctl*
|
||||
|
||||
%license %{_docdir}/warewulf/LICENSE.md
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jan 26 2022 Jeremy Siadal <jeremy.c.siadal@intel.com> - 4.2.0-1
|
||||
- Add license install
|
||||
- Updates for RH and SUSE RPM guidelines
|
||||
|
||||
* Sat Jan 15 2022 Gregory Kurtzer <gmkurtzer@gmail.com> - 4.2.0-1
|
||||
- Integrated genconfig Make options
|
||||
- Cleaned up SPEC to use default RPM macros
|
||||
|
||||
Reference in New Issue
Block a user