-
Notifications
You must be signed in to change notification settings - Fork 534
/
rules
executable file
·47 lines (38 loc) · 1.69 KB
/
rules
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
#!/usr/bin/make -ef
include /usr/share/dpkg/architecture.mk
DPKG_COREDNS_VERSION := $(shell curl -s https://api.github.com/repos/coredns/coredns/releases/latest | jq -r '.tag_name[1:length]')
# Github is ratelimiting this API pretty aggresively, error when not set.
ifeq ($(DPKG_COREDNS_VERSION),null)
$(error No version found)
endif
DEB_HOST_ARCH := $(DEB_TARGET_ARCH)
DPKG_COREDNS_DISTRIBUTION := $(shell lsb_release -sr)
PACKAGEVERSION := $(DPKG_COREDNS_VERSION)-0~$(DPKG_COREDNS_DISTRIBUTION)0
TARBALL := coredns_$(DPKG_COREDNS_VERSION)_linux_$(DEB_TARGET_ARCH).tgz
VTARBALL := v$(DPKG_COREDNS_VERSION).tar.gz
# Debian calls it armhf, we call it arm.
ifeq ($(DEB_TARGET_ARCH),armhf)
TARBALL := coredns_$(DPKG_COREDNS_VERSION)_linux_arm.tgz
endif
URL := https://github.com/coredns/coredns/releases/download/v$(DPKG_COREDNS_VERSION)/$(TARBALL)
SRC := https://github.com/coredns/coredns/archive/v$(DPKG_COREDNS_VERSION).tar.gz
%:
dh_clean
dh $@ --with systemd
override_dh_strip:
# don't perform dh_strip
echo dh_strip
override_dh_auto_clean:
override_dh_auto_test:
override_dh_auto_build:
override_dh_auto_install:
if [ ! -e $(TARBALL) ]; then curl -L $(URL) -o $(TARBALL); fi
if [ ! -e $(VTARBALL) ]; then curl -L $(SRC) -o $(VTARBALL); fi
mkdir -p debian/coredns/usr/bin debian/coredns/etc/coredns
mkdir -p debian/man v$(DPKG_COREDNS_VERSION)
tar -xf $(TARBALL) -C debian/coredns/usr/bin
tar -xf $(VTARBALL) -C v$(DPKG_COREDNS_VERSION)
cp v$(DPKG_COREDNS_VERSION)/coredns-$(DPKG_COREDNS_VERSION)/man/* debian/man/
cp debian/Corefile debian/coredns/etc/coredns/Corefile
override_dh_gencontrol:
dh_gencontrol -- -v$(PACKAGEVERSION)