coredns-deployment/debian/rules
Miek Gieben 7a53c3e6de
debian: get latest release from github (#24)
* debian: get latest release from github

Use jq to parse result, barf with an error if something goes wrong.

* typo
2017-11-13 14:50:01 +00:00

39 lines
1.1 KiB
Makefile
Executable file

#!/usr/bin/make -f
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 ($(VERSION),null)
$(error No version found)
endif
DEB_HOST_ARCH := $(DEB_TARGET_ARCH)
DISTRIBUTION := $(shell lsb_release -sr)
PACKAGEVERSION := $(VERSION)-0~$(DISTRIBUTION)0
TARBALL := coredns_$(VERSION)_linux_$(DEB_TARGET_ARCH).tgz
# Debian calls it armhf, we call it arm.
ifeq ($(DEB_TARGET_ARCH),armhf)
TARBALL := coredns_$(VERSION)_linux_arm.tgz
endif
URL := https://github.com/coredns/coredns/releases/download/v$(VERSION)/$(TARBALL)
%:
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:
curl -L $(URL) -o $(TARBALL)
mkdir -p debian/coredns/usr/bin debian/coredns/etc/coredns
tar -xf $(TARBALL) -C debian/coredns/usr/bin
cp debian/Corefile debian/coredns/etc/coredns/Corefile
override_dh_gencontrol:
dh_gencontrol -- -v$(PACKAGEVERSION)