mirror of
https://github.com/notherealmarco/coredns-deployment.git
synced 2025-03-14 14:16:16 +01:00
run make with -e so users can override makefile variables (#278)
allow environment to override makefile variables Signed-off-by: Aram Akhavan <github@aram.nubmail.ca>
This commit is contained in:
parent
7ae45a97b7
commit
3c3e28eef5
2 changed files with 16 additions and 14 deletions
|
@ -10,6 +10,8 @@ On a debian system:
|
||||||
- Run `dpkg-buildpackage -us -uc -b --target-arch ARCH`
|
- Run `dpkg-buildpackage -us -uc -b --target-arch ARCH`
|
||||||
Where ARCH can be any of the released architectures, like "amd64" or "arm".
|
Where ARCH can be any of the released architectures, like "amd64" or "arm".
|
||||||
- Most users will just run: `dpkg-buildpackage -us -uc -b`
|
- Most users will just run: `dpkg-buildpackage -us -uc -b`
|
||||||
|
- Note that any existing environment variables will override the default makefile variables in [debian/rules](debian/rules)
|
||||||
|
- The above can be used, for example, to build a particular verison by setting the `VERSION` environment variable
|
||||||
|
|
||||||
To install:
|
To install:
|
||||||
|
|
||||||
|
|
26
debian/rules
vendored
26
debian/rules
vendored
|
@ -1,26 +1,26 @@
|
||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -ef
|
||||||
|
|
||||||
include /usr/share/dpkg/architecture.mk
|
include /usr/share/dpkg/architecture.mk
|
||||||
|
|
||||||
VERSION := $(shell curl -s https://api.github.com/repos/coredns/coredns/releases/latest | jq -r '.tag_name[1:length]')
|
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.
|
# Github is ratelimiting this API pretty aggresively, error when not set.
|
||||||
ifeq ($(VERSION),null)
|
ifeq ($(DPKG_COREDNS_VERSION),null)
|
||||||
$(error No version found)
|
$(error No version found)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DEB_HOST_ARCH := $(DEB_TARGET_ARCH)
|
DEB_HOST_ARCH := $(DEB_TARGET_ARCH)
|
||||||
DISTRIBUTION := $(shell lsb_release -sr)
|
DPKG_COREDNS_DISTRIBUTION := $(shell lsb_release -sr)
|
||||||
PACKAGEVERSION := $(VERSION)-0~$(DISTRIBUTION)0
|
PACKAGEVERSION := $(DPKG_COREDNS_VERSION)-0~$(DPKG_COREDNS_DISTRIBUTION)0
|
||||||
TARBALL := coredns_$(VERSION)_linux_$(DEB_TARGET_ARCH).tgz
|
TARBALL := coredns_$(DPKG_COREDNS_VERSION)_linux_$(DEB_TARGET_ARCH).tgz
|
||||||
VTARBALL := v$(VERSION).tar.gz
|
VTARBALL := v$(DPKG_COREDNS_VERSION).tar.gz
|
||||||
|
|
||||||
# Debian calls it armhf, we call it arm.
|
# Debian calls it armhf, we call it arm.
|
||||||
ifeq ($(DEB_TARGET_ARCH),armhf)
|
ifeq ($(DEB_TARGET_ARCH),armhf)
|
||||||
TARBALL := coredns_$(VERSION)_linux_arm.tgz
|
TARBALL := coredns_$(DPKG_COREDNS_VERSION)_linux_arm.tgz
|
||||||
endif
|
endif
|
||||||
|
|
||||||
URL := https://github.com/coredns/coredns/releases/download/v$(VERSION)/$(TARBALL)
|
URL := https://github.com/coredns/coredns/releases/download/v$(DPKG_COREDNS_VERSION)/$(TARBALL)
|
||||||
SRC := https://github.com/coredns/coredns/archive/v$(VERSION).tar.gz
|
SRC := https://github.com/coredns/coredns/archive/v$(DPKG_COREDNS_VERSION).tar.gz
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh_clean
|
dh_clean
|
||||||
|
@ -37,10 +37,10 @@ override_dh_auto_install:
|
||||||
if [ ! -e $(TARBALL) ]; then curl -L $(URL) -o $(TARBALL); fi
|
if [ ! -e $(TARBALL) ]; then curl -L $(URL) -o $(TARBALL); fi
|
||||||
if [ ! -e $(VTARBALL) ]; then curl -L $(SRC) -o $(VTARBALL); fi
|
if [ ! -e $(VTARBALL) ]; then curl -L $(SRC) -o $(VTARBALL); fi
|
||||||
mkdir -p debian/coredns/usr/bin debian/coredns/etc/coredns
|
mkdir -p debian/coredns/usr/bin debian/coredns/etc/coredns
|
||||||
mkdir -p debian/man v$(VERSION)
|
mkdir -p debian/man v$(DPKG_COREDNS_VERSION)
|
||||||
tar -xf $(TARBALL) -C debian/coredns/usr/bin
|
tar -xf $(TARBALL) -C debian/coredns/usr/bin
|
||||||
tar -xf $(VTARBALL) -C v$(VERSION)
|
tar -xf $(VTARBALL) -C v$(DPKG_COREDNS_VERSION)
|
||||||
cp v$(VERSION)/coredns-$(VERSION)/man/* debian/man/
|
cp v$(DPKG_COREDNS_VERSION)/coredns-$(DPKG_COREDNS_VERSION)/man/* debian/man/
|
||||||
cp debian/Corefile debian/coredns/etc/coredns/Corefile
|
cp debian/Corefile debian/coredns/etc/coredns/Corefile
|
||||||
|
|
||||||
override_dh_gencontrol:
|
override_dh_gencontrol:
|
||||||
|
|
Loading…
Reference in a new issue