debian: add package building (#20)

This only builds on a debian system, because it uses the dpkg-helper
and other utils. But it builds! Multiarch is supported, you can easily
build a package for amd64, arm and arm64. The Makefile does this by
default.

Massively update the systemd file.
This commit is contained in:
Miek Gieben 2017-11-11 14:57:29 +00:00 committed by GitHub
parent 3313ba9e12
commit aaf5dae5dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 110 additions and 8 deletions

9
debian/Corefile vendored Normal file
View file

@ -0,0 +1,9 @@
# Default Corefile, see https://coredns.io for more information.
# Answer every below the root, with the whoami plugin. Log all queries
# and errors on standard output.
. {
whoami # coredns.io/plugins/whoami
log # coredns.io/plugins/log
errors # coredns.io/plugins/errors
}

5
debian/changelog vendored Normal file
View file

@ -0,0 +1,5 @@
coredns (0-0) UNRELEASED; urgency=medium
* Package for Debian.
-- Miek Gieben <miek@coredns.io> Sat, 11 Nov 2017 09:52:00 +0000

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
10

8
debian/control vendored Normal file
View file

@ -0,0 +1,8 @@
Source: coredns
Maintainer: Miek Gieben <miek@coredns.io>
Build-Depends: debhelper (>= 9), ca-certificates, wget, dh-systemd
Package: coredns
Architecture: any
Description: DNS server that chains plugins
Depends: adduser

20
debian/coredns.service vendored Normal file
View file

@ -0,0 +1,20 @@
[Unit]
Description=CoreDNS DNS server
Documentation=https://coredns.io
After=network.target
[Service]
PermissionsStartOnly=true
LimitNOFILE=1048576
LimitNPROC=512
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
User=coredns
WorkingDirectory=~
ExecStart=/usr/bin/coredns -conf=/etc/coredns/Corefile
ExecReload=/bin/kill -SIGUSR1 $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target

29
debian/rules vendored Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/make -f
VERSION := 0.9.10
DEB_HOST_ARCH := $(DEB_TARGET_ARCH)
DISTRIBUTION := $(shell lsb_release -sr)
PACKAGEVERSION := $(VERSION)-0~$(DISTRIBUTION)0
TARBALL := coredns_$(VERSION)_linux_$(DEB_TARGET_ARCH).tgz
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:
wget -N --progress=dot:mega $(URL)
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)