-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
83 lines (70 loc) · 1.84 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
LATEST = 15.0
VERSION = $(LATEST)
VERSIONS = 13.0 13.1 13.37 14.0 14.1 14.2 15.0 current
NAME = slackware
MIRROR = http://slackware.osuosl.org
ifeq ($(shell uname -m),x86_64)
ARCH = 64
else ifeq ($(patsubst i%86,x86,$(shell uname -m)),x86)
ARCH =
else ifeq ($(shell uname -m),armv6l)
ARCH = arm
else ifeq ($(shell uname -m),aarch64)
ARCH = arm64
else
ARCH = 64
endif
RELEASENAME ?= slackware$(ARCH)
RELEASE = $(RELEASENAME)-$(VERSION)
CACHEFS = /tmp/$(NAME)/$(RELEASE)
ROOTFS = /tmp/rootfs-$(RELEASE)
#CRT ?= podman
CRT ?= docker
ifeq ($(CRT), podman)
CRTCMD := CMD=/bin/sh
else
CRTCMD := CMD /bin/sh
endif
image: $(RELEASENAME)-$(VERSION).tar
arch:
@echo $(ARCH)
@echo $(RELEASE)
$(RELEASENAME)-%.tar: mkimage-slackware.sh
sudo \
VERSION="$*" \
USER="$(USER)" \
BUILD_NAME="$(NAME)" \
bash $<
all: mkimage-slackware.sh
for version in $(VERSIONS) ; do \
$(MAKE) $(RELEASENAME)-$${version}.tar && \
$(MAKE) VERSION=$${version} clean && \
$(MAKE) import-$${version} && \
$(MAKE) run-test-$${version} ; \
done && \
$(CRT) tag $(USER)/$(NAME):$(LATEST) $(USER)/$(NAME):latest
import-%: $(RELEASENAME)-%.tar
$(CRT) import -c '$(CRTCMD)' $(RELEASENAME)-$*.tar $(USER)/$(NAME):$*
run-%: import-%
$(CRT) run -it --rm $(USER)/$(NAME):$*
run-test-%:
$(CRT) run -i --rm $(USER)/$(NAME):$* /usr/bin/echo "$(USER)/$(NAME):$* :: Success."
.PHONY: umount
umount:
@sudo umount $(ROOTFS)/etc/resolv.conf || :
@sudo umount $(ROOTFS)/mnt/etc/resolv.conf || :
@sudo umount $(ROOTFS)/cdrom || :
@sudo umount $(ROOTFS)/dev || :
@sudo umount $(ROOTFS)/sys || :
@sudo umount $(ROOTFS)/proc || :
.PHONY: clean
clean: umount
sudo rm -rf $(ROOTFS) $(CACHEFS)/paths
.PHONY: clean-all
clean-all:
for version in $(VERSIONS) ; do \
$(MAKE) VERSION=$${version} clean ; \
done
.PHONY: dist-clean
dist-clean: clean-all
sudo rm -rf $(CACHEFS)