Skip to content

Commit

Permalink
Makefile: split build all from dealing with CTR
Browse files Browse the repository at this point in the history
I want `all` to just be building the *.tar archive of the filesystems.
So now there is an `all-container` target that uses those tar's and
imports them to the designated container runtime.

Fixes #14

Signed-off-by: Vincent Batts <[email protected]>
  • Loading branch information
vbatts committed Sep 26, 2019
1 parent 2dcb6f5 commit acb3846
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
27 changes: 16 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@ ARCH := 64
endif
RELEASENAME := slackware$(ARCH)
RELEASE := $(RELEASENAME)-$(VERSION)
CACHEFS := /tmp/$(NAME)/$(RELEASE)
ROOTFS := /tmp/rootfs-$(RELEASE)
TMPDIR := /tmp/slackware-container/
CACHEFS := $(TMPDIR)/$(NAME)/$(RELEASE)
ROOTFS := $(TMPDIR)/rootfs-$(RELEASE)
#CRT ?= podman
CRT ?= docker

export TMPDIR

ifeq ($(CRT), podman)
CRTCMD := CMD=/bin/sh
else
CRTCMD := CMD /bin/sh
endif

image: $(RELEASENAME)-$(LATEST).tar

arch:
Expand All @@ -34,11 +43,11 @@ $(RELEASENAME)-%.tar: mkimage-slackware.sh
BUILD_NAME="$(NAME)" \
bash $<

all: mkimage-slackware.sh
all: mkimage-slackware.sh $(foreach v,$(VERSIONS),$(RELEASENAME)-$(v).tar)

all-container: all
for version in $(VERSIONS) ; do \
$(MAKE) $(RELEASENAME)-$${version}.tar && \
$(MAKE) VERSION=$${version} clean && \
$(CRT) import -c 'CMD=/bin/sh' $(RELEASENAME)-$${version}.tar $(USER)/$(NAME):$${version} && \
$(CRT) import -c '$(CRTCMD)' $(RELEASENAME)-$${version}.tar $(USER)/$(NAME):$${version} && \
$(CRT) run -i --rm $(USER)/$(NAME):$${version} /usr/bin/echo "$(USER)/$(NAME):$${version} :: Success." ; \
done && \
$(CRT) tag $(USER)/$(NAME):$(LATEST) $(USER)/$(NAME):latest
Expand All @@ -53,9 +62,5 @@ umount:

.PHONY: clean
clean: umount
sudo rm -rf $(ROOTFS) $(CACHEFS)/paths

.PHONY: dist-clean
dist-clean: clean
sudo rm -rf $(CACHEFS)
sudo rm -rf $(TMPDIR)

3 changes: 3 additions & 0 deletions mkimage-slackware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Generate a very minimal filesystem from slackware

set -e
if [ -n "$DEBUG" ] ; then
set -x
fi

if [ -z "$ARCH" ]; then
case "$( uname -m )" in
Expand Down

0 comments on commit acb3846

Please sign in to comment.