aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 910689bbe7f59f5040dd71b3a7a33defb859652f (plain)
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
ARCH ?= $(shell uname -m)
ifeq (${ARCH}, x86_64)
ARCH = amd64
endif
ifeq (${ARCH}, i686)
ARCH = i386
endif

VERSION = 7.3.0

ISOIMG = debian-${VERSION}-${ARCH}-netinst.iso
PRESEEDED = $(patsubst %.iso,%-preseeded.iso, ${ISOIMG})
UDEBS = $(shell ./src/getname.sh)
CHECKSUMS = MD5 SHA1 SHA256 SHA512

# Preseed
iso-preseed:
	make dist/${ARCH}/${PRESEEDED}
dist/${ARCH}/${PRESEEDED}: preseed.cfg $(wildcard ./include/*) dist/${ARCH}/${ISOIMG} ${UDEBS}
	./preseed.sh $@ dist/${ARCH}/${ISOIMG} ${UDEBS}

# Get, verify
iso-get: dist/${ARCH}/${ISOIMG}
iso-checksum: $(patsubst %,iso-checksum-%, ${CHECKSUMS})

# Verify a single digest
iso-checksum-%: dist/${ARCH}/${ISOIMG} dist/${ARCH}/%SUMS dist/${ARCH}/%SUMS.sign
	@echo Checking $* sum
	@cd dist/${ARCH}; grep "\s${ISOIMG}$$" $*SUMS | $$(echo $* | sed 's@.*@/usr/bin/\L&sum@') --strict -c
	gpg --verify dist/${ARCH}/$*SUMS.sign

# Download
.PRECIOUS: dist/${ARCH}/%
dist/${ARCH}/%:
	@[ -d dist/${ARCH} ] || mkdir -p dist/${ARCH}
	wget -nc -P dist/${ARCH} http://cdimage.debian.org/debian-cd/current/${ARCH}/iso-cd/$*

# All udebs
udebs: ${UDEBS}

# Single udeb; TODO: GPG sign
%.udeb: UDEB = $(shell ./src/getname.sh $*)
%.udeb: $(shell /usr/bin/git ls-files -- src/${UDEB})
	@cd src/${UDEB} && /usr/bin/debuild -i -us -uc -b -a${ARCH}

clean:
	@for d in src/*-udeb/; do rm -fv $${d%-udeb/}_*.build $${d%-udeb/}_*.changes $${d%-udeb/}_*.udeb; cd $$d && dh_clean && cd -; done
	@rm -fv $(patsubst %,dist/${ARCH}/%SUMS, ${CHECKSUMS}) $(patsubst %,dist/${ARCH}/%SUMS.sign, ${CHECKSUMS})

.PHONY: clean cleanall iso-get iso-checksum iso-preseed udebs