summaryrefslogtreecommitdiff
path: root/community
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2019-12-08 14:20:56 +0100
committerJakub Jirutka <jakub@jirutka.cz>2019-12-08 14:20:37 +0100
commitcbb00b218333fce09e28a8e5eb8730c3945aeb71 (patch)
tree96f5e3fc6e8bb633cad3e856d3ef7f14e9cf9b0f /community
parent89442b46ccb0f877da416a75e0f073547b0278f4 (diff)
downloadaports-cbb00b218333fce09e28a8e5eb8730c3945aeb71.zip
community/kea: move from testing
Diffstat (limited to 'community')
-rw-r--r--community/kea/APKBUILD213
-rw-r--r--community/kea/disable-db-tests.patch18
-rw-r--r--community/kea/kea-admin-remove-builddir.patch24
-rw-r--r--community/kea/kea-common.pre-install6
-rw-r--r--community/kea/kea.initd.in32
-rw-r--r--community/kea/logs-location.patch69
-rw-r--r--community/kea/put-LOCKFILE_DIR-to-runstatedir.patch16
-rw-r--r--community/kea/use-runstatedir-for-pid-file-location.patch34
8 files changed, 412 insertions, 0 deletions
diff --git a/community/kea/APKBUILD b/community/kea/APKBUILD
new file mode 100644
index 00000000000..a9514696359
--- /dev/null
+++ b/community/kea/APKBUILD
@@ -0,0 +1,213 @@
+# Maintainer: Steve Holweg <skytep@gmail.com>
+# Contributor: Baptiste Jonglez <baptiste--aur@jonglez.org>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=kea
+pkgver=1.7.2
+pkgrel=3
+pkgdesc="DHCPv4 and DHCPv6 server from ISC"
+url="http://kea.isc.org"
+arch="all !armhf !armv7"
+license="MPL2"
+depends="kea-dhcp4 kea-dhcp6"
+checkdepends="procps"
+makedepends="
+ bison
+ boost-dev
+ botan-dev
+ flex
+ libcap
+ log4cplus-dev
+ mariadb-dev
+ postgresql-dev
+ python3-dev
+ "
+pkgusers="kea"
+pkggroups="kea"
+install="$pkgname-common.pre-install"
+subpackages="
+ $pkgname-doc
+ $pkgname-static
+ $pkgname-dev
+ $pkgname-admin::noarch
+ $pkgname-ctrl-agent:ctrlagent
+ $pkgname-dhcp-ddns:dhcpddns
+ $pkgname-dhcp4
+ $pkgname-dhcp6
+ $pkgname-hooks
+ $pkgname-http
+ $pkgname-keactrl::noarch
+ $pkgname-shell::noarch
+ $pkgname-utils
+ $pkgname-common
+ "
+source="https://ftp.isc.org/isc/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz
+ disable-db-tests.patch
+ logs-location.patch
+ use-runstatedir-for-pid-file-location.patch
+ put-LOCKFILE_DIR-to-runstatedir.patch
+ kea-admin-remove-builddir.patch
+ kea.initd.in
+ "
+validpgpkeys="BE0E9748B718253A28BB89FFF1B11BF05CF02E57" # Internet Systems Consortium, Inc. (Signing key, 2017-2018) <codesign@isc.org>
+
+prepare() {
+ default_prepare
+
+ # Remove the builddir path from the scripts.
+ # NOTE: There's a new script each release, so using patch file would be
+ # very inconvenient.
+ find src/share/database/scripts/ \
+ -name '*.sh.in' \
+ -exec sed -i 's|^\s*. @abs_top_builddir@/src/bin/admin/admin-utils.sh.*|echo "admin-utils.sh not found!"; exit 1|' {} \;
+}
+
+build() {
+ # Complete build for dev and doc
+
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --libexecdir=/usr/lib \
+ --runstatedir=/run \
+ --with-mysql \
+ --with-pgsql \
+ --disable-rpath \
+ --enable-generate-messages \
+ --enable-generate-parser \
+ --enable-shell
+ make
+}
+
+check() {
+ make check
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+
+ cd "$pkgdir"
+
+ # Allow kea to run under unpriviliged user.
+ local name; for name in kea-dhcp-ddns kea-dhcp4 kea-dhcp6; do
+ setcap 'cap_net_bind_service=+ep' ./usr/sbin/$name
+ done
+ setcap 'cap_net_raw=+ep' ./usr/sbin/kea-dhcp6
+
+ install -d -m 0750 -o kea -g kea \
+ "$pkgdir"/var/log/kea \
+ "$pkgdir"/var/lib/kea
+
+ rm -Rf ./run
+}
+
+admin() {
+ pkgdesc="Databases administration tools for Kea DHCP server"
+ depends="$pkgname-common=$pkgver-r$pkgrel"
+
+ amove ./usr/sbin/kea-admin
+ amove ./usr/share/kea/
+}
+
+ctrlagent() {
+ pkgdesc="Kea Control Agent - REST service for controlling Kea DHCP server"
+ depends="$pkgname-common=$pkgver-r$pkgrel"
+
+ amove usr/sbin/kea-ctrl-agent
+ amove ./etc/kea/kea-ctrl-agent.conf
+
+ _install_initd kea-ctrl-agent
+}
+
+dhcpddns() {
+ pkgdesc="Kea DHCP Dynamic DNS Server"
+ depends="$pkgname-common=$pkgver-r$pkgrel"
+
+ amove ./usr/sbin/kea-dhcp-ddns
+ amove ./etc/kea/kea-dhcp-ddns.conf
+ amove ./usr/lib/libkea-asiodns.so.*
+
+ _install_initd kea-dhcp-ddns
+}
+
+dhcp4() {
+ pkgdesc="Kea IPv4 DHCP Server"
+ depends="$pkgname-common=$pkgver-r$pkgrel"
+
+ amove ./usr/sbin/kea-dhcp4
+ amove ./etc/kea/kea-dhcp4.conf
+
+ _install_initd kea-dhcp4
+}
+
+dhcp6() {
+ pkgdesc="Kea IPv6 DHCP Server"
+ depends="$pkgname-common=$pkgver-r$pkgrel"
+
+ amove ./usr/sbin/kea-dhcp6
+ amove ./etc/kea/kea-dhcp6.conf
+
+ _install_initd kea-dhcp6
+}
+
+hooks() {
+ pkgdesc="Hooks libraries for Kea DHCP server"
+ depends=""
+
+ amove ./usr/lib/kea/hooks/
+}
+
+# Needed only by ctrl-agent and hooks.
+http() {
+ depends=""
+
+ amove ./usr/lib/libkea-http.so*
+}
+
+keactrl() {
+ pkgdesc="Kea DHCP Process Manager"
+ depends=""
+
+ amove ./usr/sbin/keactrl
+ amove ./etc/kea/keactrl.conf
+}
+
+shell() {
+ pkgdesc="Text client for Kea DHCP Control Agent"
+ depends="python3"
+
+ amove ./usr/sbin/kea-shell
+ amove ./usr/lib/python3*
+}
+
+utils() {
+ pkgdesc="Optional utilities for Kea DHCP Server"
+ depends=""
+
+ amove ./usr/sbin/kea-lfc
+}
+
+common() {
+ pkgdesc="Common files and libraries for Kea DHCP Server"
+ depends=""
+
+ mkdir -p "$subpkgdir"
+ mv "$pkgdir"/* "$subpkgdir"/
+}
+
+_install_initd() {
+ local name="$1"
+
+ install -Dm755 "$srcdir"/kea.initd.in "$subpkgdir"/etc/init.d/$name
+ sed -i "s|@@NAME@@|$name|g" "$subpkgdir"/etc/init.d/$name
+}
+
+sha512sums="f84bed2e1dacd172c7aed8e4d6c11ec5e79f37ad2c7991963fc9c4a1761668f9f0e105ba5c4deed06264ab2ec13b1b5787350d823de12fd3782223192e3653f2 kea-1.7.2.tar.gz
+55780bbcbd79b81d55bdccd46da6ca6babe8b7894aa82948308dc4f8a0e2b5d33fad633276696c8ba7bd063026bb11ae529a096375d0572833c66e2132888775 disable-db-tests.patch
+4336bb6708d51729065da4dd3a3e96bbcbac7716b4bbde360af3c4599719c2fa9362055ae6c00043e7581f2f4af5a51d24f2e8cfaabefdb1f4d545c24af33f94 logs-location.patch
+574b4aacef03c2d4a556b4ff8b152b66efd6fdc27ad09373d41c72df15f8a2cd2386e0bbe7e07f1370d9cd11e0954fc679f3d57e6b647d601cc06e0c63bc8712 use-runstatedir-for-pid-file-location.patch
+062e6eb88c49aeeac5d78c37c43cda1ff753e19f833aaa1525e37f66eede819910d4849bd954f3ef8ceb1b13e747953c99e2a9a4d9755b6da8d82c4e08b2b55c put-LOCKFILE_DIR-to-runstatedir.patch
+5b93d96f2cbdce327ffceef5ace19ba5327a0c7d0d61714e35a0d72912ecbbec6a1864249612b48f8db20dffc3622170c3e21b1a67297fd834f47b94db85b9d7 kea-admin-remove-builddir.patch
+57bed5c19aeb03218228a0b1244e7036ed80eaacb55e9799c9ba86619662f34c858512212b69b30c11b9b592ff776a82193ccd6fccffb6b3daa016e6d9197528 kea.initd.in"
diff --git a/community/kea/disable-db-tests.patch b/community/kea/disable-db-tests.patch
new file mode 100644
index 00000000000..4c67ff64a80
--- /dev/null
+++ b/community/kea/disable-db-tests.patch
@@ -0,0 +1,18 @@
+Tests for MySQL/PostgreSQL/Cassandra integration are kinda broken, they expect
+already initialized databases prepared for Kea tests.
+
+We have to modify the autohelled Makefile.in instead of Makefile.am because Kea
+requires old automake-1.15.
+
+--- a/src/bin/admin/tests/Makefile.in
++++ b/src/bin/admin/tests/Makefile.in
+@@ -389,8 +389,7 @@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ SUBDIRS = data .
+-SHTESTS = memfile_tests.sh $(am__append_1) $(am__append_2) \
+- $(am__append_3)
++SHTESTS = memfile_tests.sh
+ noinst_SCRIPTS = $(SHTESTS)
+ EXTRA_DIST = dhcpdb_create_1.0.mysql dhcpdb_create_1.0.pgsql \
+ dhcpdb_create_1.0.cql
diff --git a/community/kea/kea-admin-remove-builddir.patch b/community/kea/kea-admin-remove-builddir.patch
new file mode 100644
index 00000000000..70cf7487d92
--- /dev/null
+++ b/community/kea/kea-admin-remove-builddir.patch
@@ -0,0 +1,24 @@
+From: Kea <isc-kea@packages.debian.org>
+Date: Tue, 19 Feb 2019 12:39:35 +0000
+Subject: kea_admin_fix
+
+Removed the fallback to the build version of kea-admin since it will not exist on users hosts.
+
+Patch-Source: https://sources.debian.org/src/isc-kea/1.5.0-2/debian/patches/0003-kea_admin_fix/
+---
+ src/bin/admin/kea-admin.in | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/bin/admin/kea-admin.in b/src/bin/admin/kea-admin.in
+index 3d391df..dcb8bff 100644
+--- a/src/bin/admin/kea-admin.in
++++ b/src/bin/admin/kea-admin.in
+@@ -37,8 +37,6 @@ dump_qry=""
+ # use build version if it isn't.
+ if [ -e @datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh ]; then
+ . @datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh
+-else
+- . @abs_top_srcdir@/src/bin/admin/admin-utils.sh
+ fi
+
+ # Prints out usage version.
diff --git a/community/kea/kea-common.pre-install b/community/kea/kea-common.pre-install
new file mode 100644
index 00000000000..820a35b364c
--- /dev/null
+++ b/community/kea/kea-common.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S kea 2>/dev/null
+adduser -S -D -H -h /var/lib/kea -s /sbin/nologin -G kea -g "Kea" kea 2>/dev/null
+
+exit 0
diff --git a/community/kea/kea.initd.in b/community/kea/kea.initd.in
new file mode 100644
index 00000000000..7d2b39617ab
--- /dev/null
+++ b/community/kea/kea.initd.in
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+
+: ${cfgfile:="/etc/kea/@@NAME@@.conf"}
+: ${command_user:="kea"}
+: ${wait:=100}
+
+name="@@NAME@@"
+extra_commands="checkconfig"
+description_checkconfig="Checks configuration file for errors"
+
+command="/usr/sbin/@@NAME@@"
+command_args="-c $cfgfile"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+start_stop_daemon_args="--wait $wait $start_stop_daemon_args"
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath -d -m 0750 -o $command_user /run/kea /run/kea/lock
+
+ checkconfig
+}
+
+checkconfig() {
+ ebegin "Checking $name configuration"
+ $command -t "$cfgfile" >/dev/null
+ eend $?
+}
diff --git a/community/kea/logs-location.patch b/community/kea/logs-location.patch
new file mode 100644
index 00000000000..b55233b7bf0
--- /dev/null
+++ b/community/kea/logs-location.patch
@@ -0,0 +1,69 @@
+We have to move logs from /var/log to /var/log/kea to allow running
+under unprivileged user.
+
+--- a/src/bin/keactrl/kea-ctrl-agent.conf.pre
++++ b/src/bin/keactrl/kea-ctrl-agent.conf.pre
+@@ -67,7 +67,7 @@
+ // - syslog (logs to syslog)
+ // - syslog:name (logs to syslog using specified name)
+ // Any other value is considered a name of a time
+- "output": "@localstatedir@/log/kea-ctrl-agent.log"
++ "output": "@localstatedir@/log/kea/kea-ctrl-agent.log"
+
+ // Shorter log pattern suitable for use with systemd,
+ // avoids redundant information
+--- a/src/bin/keactrl/kea-dhcp-ddns.conf.pre
++++ b/src/bin/keactrl/kea-dhcp-ddns.conf.pre
+@@ -44,7 +44,7 @@
+ // - syslog (logs to syslog)
+ // - syslog:name (logs to syslog using specified name)
+ // Any other value is considered a name of a time
+- "output": "@localstatedir@/log/kea-ddns.log"
++ "output": "@localstatedir@/log/kea/kea-ddns.log"
+
+ // Shorter log pattern suitable for use with systemd,
+ // avoids redundant information
+--- a/src/bin/keactrl/kea-dhcp4.conf.pre
++++ b/src/bin/keactrl/kea-dhcp4.conf.pre
+@@ -428,7 +428,7 @@
+ // - syslog (logs to syslog)
+ // - syslog:name (logs to syslog using specified name)
+ // Any other value is considered a name of a time
+- "output": "@localstatedir@/log/kea-dhcp4.log"
++ "output": "@localstatedir@/log/kea/kea-dhcp4.log"
+
+ // Shorter log pattern suitable for use with systemd,
+ // avoids redundant information
+--- a/src/bin/keactrl/kea-dhcp6.conf.pre
++++ b/src/bin/keactrl/kea-dhcp6.conf.pre
+@@ -353,7 +353,7 @@
+ // - syslog (logs to syslog)
+ // - syslog:name (logs to syslog using specified name)
+ // Any other value is considered a name of a time
+- "output": "@localstatedir@/log/kea-dhcp6.log"
++ "output": "@localstatedir@/log/kea/kea-dhcp6.log"
+
+ // Shorter log pattern suitable for use with systemd,
+ // avoids redundant information
+--- a/src/bin/keactrl/kea-netconf.conf.pre
++++ b/src/bin/keactrl/kea-netconf.conf.pre
+@@ -69,7 +69,7 @@
+ // - syslog (logs to syslog)
+ // - syslog:name (logs to syslog using specified name)
+ // Any other value is considered a name of a time
+- "output": "@localstatedir@/log/kea-netconf.log"
++ "output": "@localstatedir@/log/kea/kea-netconf.log"
+
+ // Shorter log pattern suitable for use with systemd,
+ // avoids redundant information
+--- a/src/bin/keactrl/keactrl.in
++++ b/src/bin/keactrl/keactrl.in
+@@ -333,7 +333,7 @@
+ # to the default file.
+ if [ -z "${KEA_LOGGER_DESTINATION}" ]; then
+ prefix=@prefix@
+- export KEA_LOGGER_DESTINATION=@localstatedir@/log/kea.log
++ export KEA_LOGGER_DESTINATION=@localstatedir@/log/kea/kea.log
+ fi
+
+ command=${1}
diff --git a/community/kea/put-LOCKFILE_DIR-to-runstatedir.patch b/community/kea/put-LOCKFILE_DIR-to-runstatedir.patch
new file mode 100644
index 00000000000..965c5e58299
--- /dev/null
+++ b/community/kea/put-LOCKFILE_DIR-to-runstatedir.patch
@@ -0,0 +1,16 @@
+This patch is based on https://sources.debian.org/src/isc-kea/1.5.0-2/debian/patches/0005-Put-KEA_LOCKFILE_DIR-to-runstatedir.patch/
+
+We have to modify the autohelled Makefile.in instead of Makefile.am because Kea
+requires old automake-1.15.
+
+--- a/src/lib/log/interprocess/Makefile.in
++++ b/src/lib/log/interprocess/Makefile.in
+@@ -434,7 +434,7 @@
+ top_srcdir = @top_srcdir@
+ SUBDIRS = . tests
+ AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib \
+- -DLOCKFILE_DIR=\"$(localstatedir)/run/$(PACKAGE_NAME)\" \
++ -DLOCKFILE_DIR=\"$(runstatedir)/$(PACKAGE_NAME)\" \
+ $(BOOST_INCLUDES)
+ AM_CXXFLAGS = $(KEA_CXXFLAGS)
+ CLEANFILES = *.gcno *.gcda
diff --git a/community/kea/use-runstatedir-for-pid-file-location.patch b/community/kea/use-runstatedir-for-pid-file-location.patch
new file mode 100644
index 00000000000..146026b5e0f
--- /dev/null
+++ b/community/kea/use-runstatedir-for-pid-file-location.patch
@@ -0,0 +1,34 @@
+From: =?utf-8?b?T25kxZllaiBTdXLDvQ==?= <ondrej@sury.org>
+Date: Tue, 19 Feb 2019 12:55:42 +0000
+Subject: Use runstatedir for pid file location
+
+We have to modify the autohelled Makefile.in instead of Makefile.am because Kea
+requires old automake-1.15.
+
+Patch-Source: https://sources.debian.org/src/isc-kea/1.5.0-2/debian/patches/0004-Use-runstatedir-for-pid-file-location.patch/
+
+--- a/src/lib/process/Makefile.in
++++ b/src/lib/process/Makefile.in
+@@ -487,10 +487,8 @@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ SUBDIRS = . testutils tests
+-# DATA_DIR is the directory where to put PID files.
+-dhcp_data_dir = @runstatedir@/@PACKAGE@
+ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib \
+- -DDATA_DIR="\"$(dhcp_data_dir)\"" $(BOOST_INCLUDES)
++ -DKEA_PIDFILE_DIR="\"$(runstatedir)/$(PACKAGE_NAME)\"" $(BOOST_INCLUDES)
+ AM_CXXFLAGS = $(KEA_CXXFLAGS)
+
+ # Ensure that the message file is included in the distribution
+--- a/src/lib/process/daemon.cc
++++ b/src/lib/process/daemon.cc
+@@ -37,7 +37,7 @@
+
+ Daemon::Daemon()
+ : signal_set_(), signal_handler_(), config_file_(""),
+- pid_file_dir_(DATA_DIR), pid_file_(), am_file_author_(false) {
++ pid_file_dir_(KEA_PIDFILE_DIR), pid_file_(), am_file_author_(false) {
+
+ // The pid_file_dir can be overridden via environment variable
+ // This is primarily intended to simplify testing