From 9ec86a18b41919176f2ece96d3fb7bccb4da0196 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Wed, 30 Nov 2022 11:20:39 +0100 Subject: [PATCH] enable the warewulf service --- Dockerfile | 8 ++++++-- Makefile | 7 +++---- container-scripts/label-install | 2 +- internal/pkg/container/kernel.go | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1ae12012..ceaa9bca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,7 @@ LABEL maintainer="Christian Goll " COPY --from=builder /usr/bin/wwctl /usr/bin/wwctl COPY --from=builder /var/lib/warewulf /var/lib/warewulf COPY --from=builder /usr/share/warewulf /usr/share/warewulf +COPY --from=builder /usr/lib/systemd/system/warewulfd.service /container-scripts/warewulfd.service COPY --from=builder /etc/warewulf /etc/warewulf COPY --from=builder /warewulf-src/container-scripts /container-scripts @@ -49,6 +50,7 @@ RUN zypper -n install \ less \ dhcp-server \ iproute2 \ + vim \ tftp \ systemd \ && \ @@ -74,11 +76,13 @@ RUN zypper -n install \ mkdir -p /usr/share/bash_completion/completions/ &&\ cp /etc/warewulf/bash_completion.d/warewulf /usr/share/bash_completion/completions/wwctl &&\ mv -v container-scripts/ww4-config.service /etc/systemd/system/ &&\ - systemctl enable ww4-config + mv -v container-scripts/warewulfd.service /etc/systemd/system/ &&\ + systemctl enable ww4-config &&\ + systemctl enable warewulfd CMD [ "/usr/sbin/init" ] -EXPOSE 67/udp 68/udp 69/udp 9873 +EXPOSE 67/udp 68/udp 69/udp 80 9873 LABEL INSTALL="/usr/bin/docker run --env IMAGE=IMAGE --rm --privileged -v /:/host IMAGE /bin/bash /container/label-install" LABEL UNINSTALL="/usr/bin/docker run --rm --privileged -v /:/host IMAGE /bin/bash /container/label-uninstall" diff --git a/Makefile b/Makefile index 993c032e..96405da0 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ $(GOLANGCI_LINT): setup: vendor $(TOOLS_DIR) setup_tools vendor: - ifndef OFFLINE_BUILD +ifndef OFFLINE_BUILD go mod tidy -v go mod vendor endif @@ -125,7 +125,7 @@ $(TOOLS_DIR): # Pre-build steps for source, such as "go generate" config: - # Store configuration for subsequent runs +# 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/*" \ @@ -256,8 +256,7 @@ warewulfconf: config_defaults dist: vendor config rm -rf .dist/$(WAREWULF)-$(VERSION) $(WAREWULF)-$(VERSION).tar.gz mkdir -p .dist/$(WAREWULF)-$(VERSION) - cp -rap * .dist/$(WAREWULF)-$(VERSION)/ - find .dist/$(WAREWULF)-$(VERSION)/ -type f -name '*~' -delete + rsync -a --exclude=".*" --exclude "*~" * .dist/$(WAREWULF)-$(VERSION)/ cd .dist; tar -czf ../$(WAREWULF)-$(VERSION).tar.gz $(WAREWULF)-$(VERSION) rm -rf .dist diff --git a/container-scripts/label-install b/container-scripts/label-install index 35c99e33..e29365fb 100755 --- a/container-scripts/label-install +++ b/container-scripts/label-install @@ -43,7 +43,7 @@ fi sync_dir() { DIR=$1 test -e /host/${DIR} || mkdir -pv /host/${DIR} - test -e /host/${DIR} && (rsync -au ${DIR} `dirname /host/${DIR}`; echo "updating $DIR") + test -e /host/${DIR} && (rsync -au --ignore-existing ${DIR} `dirname /host/${DIR}`; echo "updating $DIR") } # For podman, cp a systemd unit for starting on boot diff --git a/internal/pkg/container/kernel.go b/internal/pkg/container/kernel.go index c3f94db0..1e50df65 100644 --- a/internal/pkg/container/kernel.go +++ b/internal/pkg/container/kernel.go @@ -15,11 +15,11 @@ var ( `vmlinuz`, `vmlinux-*`, `vmlinuz-*`, - `vmlinuz.gz` } + `vmlinuz.gz`} kernelDirs = []string{ `/lib/modules/*/`, - `/boot/` } + `/boot/`} ) func KernelFind(container string) string {