aboutsummaryrefslogtreecommitdiff
path: root/community/kea
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/kea
parent89442b46ccb0f877da416a75e0f073547b0278f4 (diff)
downloadalpine_aports-cbb00b218333fce09e28a8e5eb8730c3945aeb71.tar.bz2
alpine_aports-cbb00b218333fce09e28a8e5eb8730c3945aeb71.tar.xz
alpine_aports-cbb00b218333fce09e28a8e5eb8730c3945aeb71.zip
community/kea: move from testing
Diffstat (limited to 'community/kea')
-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 0000000000..a951469635
--- /dev/null
+++ b/community/kea/APKBUILD
@@ -0,0 +1,213 @@
1# Maintainer: Steve Holweg <skytep@gmail.com>
2# Contributor: Baptiste Jonglez <baptiste--aur@jonglez.org>
3# Contributor: Jakub Jirutka <jakub@jirutka.cz>
4pkgname=kea
5pkgver=1.7.2
6pkgrel=3
7pkgdesc="DHCPv4 and DHCPv6 server from ISC"
8url="http://kea.isc.org"
9arch="all !armhf !armv7"
10license="MPL2"
11depends="kea-dhcp4 kea-dhcp6"
12checkdepends="procps"
13makedepends="
14 bison
15 boost-dev
16 botan-dev
17 flex
18 libcap
19 log4cplus-dev
20 mariadb-dev
21 postgresql-dev
22 python3-dev
23 "
24pkgusers="kea"
25pkggroups="kea"
26install="$pkgname-common.pre-install"
27subpackages="
28 $pkgname-doc
29 $pkgname-static
30 $pkgname-dev
31 $pkgname-admin::noarch
32 $pkgname-ctrl-agent:ctrlagent
33 $pkgname-dhcp-ddns:dhcpddns
34 $pkgname-dhcp4
35 $pkgname-dhcp6
36 $pkgname-hooks
37 $pkgname-http
38 $pkgname-keactrl::noarch
39 $pkgname-shell::noarch
40 $pkgname-utils
41 $pkgname-common
42 "
43source="https://ftp.isc.org/isc/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz
44 disable-db-tests.patch
45 logs-location.patch
46 use-runstatedir-for-pid-file-location.patch
47 put-LOCKFILE_DIR-to-runstatedir.patch
48 kea-admin-remove-builddir.patch
49 kea.initd.in
50 "
51validpgpkeys="BE0E9748B718253A28BB89FFF1B11BF05CF02E57" # Internet Systems Consortium, Inc. (Signing key, 2017-2018) <codesign@isc.org>
52
53prepare() {
54 default_prepare
55
56 # Remove the builddir path from the scripts.
57 # NOTE: There's a new script each release, so using patch file would be
58 # very inconvenient.
59 find src/share/database/scripts/ \
60 -name '*.sh.in' \
61 -exec sed -i 's|^\s*. @abs_top_builddir@/src/bin/admin/admin-utils.sh.*|echo "admin-utils.sh not found!"; exit 1|' {} \;
62}
63
64build() {
65 # Complete build for dev and doc
66
67 ./configure \
68 --build=$CBUILD \
69 --host=$CHOST \
70 --prefix=/usr \
71 --sysconfdir=/etc \
72 --localstatedir=/var \
73 --libexecdir=/usr/lib \
74 --runstatedir=/run \
75 --with-mysql \
76 --with-pgsql \
77 --disable-rpath \
78 --enable-generate-messages \
79 --enable-generate-parser \
80 --enable-shell
81 make
82}
83
84check() {
85 make check
86}
87
88package() {
89 make DESTDIR="$pkgdir" install
90
91 cd "$pkgdir"
92
93 # Allow kea to run under unpriviliged user.
94 local name; for name in kea-dhcp-ddns kea-dhcp4 kea-dhcp6; do
95 setcap 'cap_net_bind_service=+ep' ./usr/sbin/$name
96 done
97 setcap 'cap_net_raw=+ep' ./usr/sbin/kea-dhcp6
98
99 install -d -m 0750 -o kea -g kea \
100 "$pkgdir"/var/log/kea \
101 "$pkgdir"/var/lib/kea
102
103 rm -Rf ./run
104}
105
106admin() {
107 pkgdesc="Databases administration tools for Kea DHCP server"
108 depends="$pkgname-common=$pkgver-r$pkgrel"
109
110 amove ./usr/sbin/kea-admin
111 amove ./usr/share/kea/
112}
113
114ctrlagent() {
115 pkgdesc="Kea Control Agent - REST service for controlling Kea DHCP server"
116 depends="$pkgname-common=$pkgver-r$pkgrel"
117
118 amove usr/sbin/kea-ctrl-agent
119 amove ./etc/kea/kea-ctrl-agent.conf
120
121 _install_initd kea-ctrl-agent
122}
123
124dhcpddns() {
125 pkgdesc="Kea DHCP Dynamic DNS Server"
126 depends="$pkgname-common=$pkgver-r$pkgrel"
127
128 amove ./usr/sbin/kea-dhcp-ddns
129 amove ./etc/kea/kea-dhcp-ddns.conf
130 amove ./usr/lib/libkea-asiodns.so.*
131
132 _install_initd kea-dhcp-ddns
133}
134
135dhcp4() {
136 pkgdesc="Kea IPv4 DHCP Server"
137 depends="$pkgname-common=$pkgver-r$pkgrel"
138
139 amove ./usr/sbin/kea-dhcp4
140 amove ./etc/kea/kea-dhcp4.conf
141
142 _install_initd kea-dhcp4
143}
144
145dhcp6() {
146 pkgdesc="Kea IPv6 DHCP Server"
147 depends="$pkgname-common=$pkgver-r$pkgrel"
148
149 amove ./usr/sbin/kea-dhcp6
150 amove ./etc/kea/kea-dhcp6.conf
151
152 _install_initd kea-dhcp6
153}
154
155hooks() {
156 pkgdesc="Hooks libraries for Kea DHCP server"
157 depends=""
158
159 amove ./usr/lib/kea/hooks/
160}
161
162# Needed only by ctrl-agent and hooks.
163http() {
164 depends=""
165
166 amove ./usr/lib/libkea-http.so*
167}
168
169keactrl() {
170 pkgdesc="Kea DHCP Process Manager"
171 depends=""
172
173 amove ./usr/sbin/keactrl
174 amove ./etc/kea/keactrl.conf
175}
176
177shell() {
178 pkgdesc="Text client for Kea DHCP Control Agent"
179 depends="python3"
180
181 amove ./usr/sbin/kea-shell
182 amove ./usr/lib/python3*
183}
184
185utils() {
186 pkgdesc="Optional utilities for Kea DHCP Server"
187 depends=""
188
189 amove ./usr/sbin/kea-lfc
190}
191
192common() {
193 pkgdesc="Common files and libraries for Kea DHCP Server"
194 depends=""
195
196 mkdir -p "$subpkgdir"
197 mv "$pkgdir"/* "$subpkgdir"/
198}
199
200_install_initd() {
201 local name="$1"
202
203 install -Dm755 "$srcdir"/kea.initd.in "$subpkgdir"/etc/init.d/$name
204 sed -i "s|@@NAME@@|$name|g" "$subpkgdir"/etc/init.d/$name
205}
206
207sha512sums="f84bed2e1dacd172c7aed8e4d6c11ec5e79f37ad2c7991963fc9c4a1761668f9f0e105ba5c4deed06264ab2ec13b1b5787350d823de12fd3782223192e3653f2 kea-1.7.2.tar.gz
20855780bbcbd79b81d55bdccd46da6ca6babe8b7894aa82948308dc4f8a0e2b5d33fad633276696c8ba7bd063026bb11ae529a096375d0572833c66e2132888775 disable-db-tests.patch
2094336bb6708d51729065da4dd3a3e96bbcbac7716b4bbde360af3c4599719c2fa9362055ae6c00043e7581f2f4af5a51d24f2e8cfaabefdb1f4d545c24af33f94 logs-location.patch
210574b4aacef03c2d4a556b4ff8b152b66efd6fdc27ad09373d41c72df15f8a2cd2386e0bbe7e07f1370d9cd11e0954fc679f3d57e6b647d601cc06e0c63bc8712 use-runstatedir-for-pid-file-location.patch
211062e6eb88c49aeeac5d78c37c43cda1ff753e19f833aaa1525e37f66eede819910d4849bd954f3ef8ceb1b13e747953c99e2a9a4d9755b6da8d82c4e08b2b55c put-LOCKFILE_DIR-to-runstatedir.patch
2125b93d96f2cbdce327ffceef5ace19ba5327a0c7d0d61714e35a0d72912ecbbec6a1864249612b48f8db20dffc3622170c3e21b1a67297fd834f47b94db85b9d7 kea-admin-remove-builddir.patch
21357bed5c19aeb03218228a0b1244e7036ed80eaacb55e9799c9ba86619662f34c858512212b69b30c11b9b592ff776a82193ccd6fccffb6b3daa016e6d9197528 kea.initd.in"
diff --git a/community/kea/disable-db-tests.patch b/community/kea/disable-db-tests.patch
new file mode 100644
index 0000000000..4c67ff64a8
--- /dev/null
+++ b/community/kea/disable-db-tests.patch
@@ -0,0 +1,18 @@
1Tests for MySQL/PostgreSQL/Cassandra integration are kinda broken, they expect
2already initialized databases prepared for Kea tests.
3
4We have to modify the autohelled Makefile.in instead of Makefile.am because Kea
5requires old automake-1.15.
6
7--- a/src/bin/admin/tests/Makefile.in
8+++ b/src/bin/admin/tests/Makefile.in
9@@ -389,8 +389,7 @@
10 top_builddir = @top_builddir@
11 top_srcdir = @top_srcdir@
12 SUBDIRS = data .
13-SHTESTS = memfile_tests.sh $(am__append_1) $(am__append_2) \
14- $(am__append_3)
15+SHTESTS = memfile_tests.sh
16 noinst_SCRIPTS = $(SHTESTS)
17 EXTRA_DIST = dhcpdb_create_1.0.mysql dhcpdb_create_1.0.pgsql \
18 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 0000000000..70cf7487d9
--- /dev/null
+++ b/community/kea/kea-admin-remove-builddir.patch
@@ -0,0 +1,24 @@
1From: Kea <isc-kea@packages.debian.org>
2Date: Tue, 19 Feb 2019 12:39:35 +0000
3Subject: kea_admin_fix
4
5Removed the fallback to the build version of kea-admin since it will not exist on users hosts.
6
7Patch-Source: https://sources.debian.org/src/isc-kea/1.5.0-2/debian/patches/0003-kea_admin_fix/
8---
9 src/bin/admin/kea-admin.in | 2 --
10 1 file changed, 2 deletions(-)
11
12diff --git a/src/bin/admin/kea-admin.in b/src/bin/admin/kea-admin.in
13index 3d391df..dcb8bff 100644
14--- a/src/bin/admin/kea-admin.in
15+++ b/src/bin/admin/kea-admin.in
16@@ -37,8 +37,6 @@ dump_qry=""
17 # use build version if it isn't.
18 if [ -e @datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh ]; then
19 . @datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh
20-else
21- . @abs_top_srcdir@/src/bin/admin/admin-utils.sh
22 fi
23
24 # 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 0000000000..820a35b364
--- /dev/null
+++ b/community/kea/kea-common.pre-install
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3addgroup -S kea 2>/dev/null
4adduser -S -D -H -h /var/lib/kea -s /sbin/nologin -G kea -g "Kea" kea 2>/dev/null
5
6exit 0
diff --git a/community/kea/kea.initd.in b/community/kea/kea.initd.in
new file mode 100644
index 0000000000..7d2b39617a
--- /dev/null
+++ b/community/kea/kea.initd.in
@@ -0,0 +1,32 @@
1#!/sbin/openrc-run
2
3: ${cfgfile:="/etc/kea/@@NAME@@.conf"}
4: ${command_user:="kea"}
5: ${wait:=100}
6
7name="@@NAME@@"
8extra_commands="checkconfig"
9description_checkconfig="Checks configuration file for errors"
10
11command="/usr/sbin/@@NAME@@"
12command_args="-c $cfgfile"
13command_background="yes"
14pidfile="/run/$RC_SVCNAME.pid"
15start_stop_daemon_args="--wait $wait $start_stop_daemon_args"
16
17depend() {
18 need net
19 after firewall
20}
21
22start_pre() {
23 checkpath -d -m 0750 -o $command_user /run/kea /run/kea/lock
24
25 checkconfig
26}
27
28checkconfig() {
29 ebegin "Checking $name configuration"
30 $command -t "$cfgfile" >/dev/null
31 eend $?
32}
diff --git a/community/kea/logs-location.patch b/community/kea/logs-location.patch
new file mode 100644
index 0000000000..b55233b7bf
--- /dev/null
+++ b/community/kea/logs-location.patch
@@ -0,0 +1,69 @@
1We have to move logs from /var/log to /var/log/kea to allow running
2under unprivileged user.
3
4--- a/src/bin/keactrl/kea-ctrl-agent.conf.pre
5+++ b/src/bin/keactrl/kea-ctrl-agent.conf.pre
6@@ -67,7 +67,7 @@
7 // - syslog (logs to syslog)
8 // - syslog:name (logs to syslog using specified name)
9 // Any other value is considered a name of a time
10- "output": "@localstatedir@/log/kea-ctrl-agent.log"
11+ "output": "@localstatedir@/log/kea/kea-ctrl-agent.log"
12
13 // Shorter log pattern suitable for use with systemd,
14 // avoids redundant information
15--- a/src/bin/keactrl/kea-dhcp-ddns.conf.pre
16+++ b/src/bin/keactrl/kea-dhcp-ddns.conf.pre
17@@ -44,7 +44,7 @@
18 // - syslog (logs to syslog)
19 // - syslog:name (logs to syslog using specified name)
20 // Any other value is considered a name of a time
21- "output": "@localstatedir@/log/kea-ddns.log"
22+ "output": "@localstatedir@/log/kea/kea-ddns.log"
23
24 // Shorter log pattern suitable for use with systemd,
25 // avoids redundant information
26--- a/src/bin/keactrl/kea-dhcp4.conf.pre
27+++ b/src/bin/keactrl/kea-dhcp4.conf.pre
28@@ -428,7 +428,7 @@
29 // - syslog (logs to syslog)
30 // - syslog:name (logs to syslog using specified name)
31 // Any other value is considered a name of a time
32- "output": "@localstatedir@/log/kea-dhcp4.log"
33+ "output": "@localstatedir@/log/kea/kea-dhcp4.log"
34
35 // Shorter log pattern suitable for use with systemd,
36 // avoids redundant information
37--- a/src/bin/keactrl/kea-dhcp6.conf.pre
38+++ b/src/bin/keactrl/kea-dhcp6.conf.pre
39@@ -353,7 +353,7 @@
40 // - syslog (logs to syslog)
41 // - syslog:name (logs to syslog using specified name)
42 // Any other value is considered a name of a time
43- "output": "@localstatedir@/log/kea-dhcp6.log"
44+ "output": "@localstatedir@/log/kea/kea-dhcp6.log"
45
46 // Shorter log pattern suitable for use with systemd,
47 // avoids redundant information
48--- a/src/bin/keactrl/kea-netconf.conf.pre
49+++ b/src/bin/keactrl/kea-netconf.conf.pre
50@@ -69,7 +69,7 @@
51 // - syslog (logs to syslog)
52 // - syslog:name (logs to syslog using specified name)
53 // Any other value is considered a name of a time
54- "output": "@localstatedir@/log/kea-netconf.log"
55+ "output": "@localstatedir@/log/kea/kea-netconf.log"
56
57 // Shorter log pattern suitable for use with systemd,
58 // avoids redundant information
59--- a/src/bin/keactrl/keactrl.in
60+++ b/src/bin/keactrl/keactrl.in
61@@ -333,7 +333,7 @@
62 # to the default file.
63 if [ -z "${KEA_LOGGER_DESTINATION}" ]; then
64 prefix=@prefix@
65- export KEA_LOGGER_DESTINATION=@localstatedir@/log/kea.log
66+ export KEA_LOGGER_DESTINATION=@localstatedir@/log/kea/kea.log
67 fi
68
69 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 0000000000..965c5e5829
--- /dev/null
+++ b/community/kea/put-LOCKFILE_DIR-to-runstatedir.patch
@@ -0,0 +1,16 @@
1This 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/
2
3We have to modify the autohelled Makefile.in instead of Makefile.am because Kea
4requires old automake-1.15.
5
6--- a/src/lib/log/interprocess/Makefile.in
7+++ b/src/lib/log/interprocess/Makefile.in
8@@ -434,7 +434,7 @@
9 top_srcdir = @top_srcdir@
10 SUBDIRS = . tests
11 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib \
12- -DLOCKFILE_DIR=\"$(localstatedir)/run/$(PACKAGE_NAME)\" \
13+ -DLOCKFILE_DIR=\"$(runstatedir)/$(PACKAGE_NAME)\" \
14 $(BOOST_INCLUDES)
15 AM_CXXFLAGS = $(KEA_CXXFLAGS)
16 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 0000000000..146026b5e0
--- /dev/null
+++ b/community/kea/use-runstatedir-for-pid-file-location.patch
@@ -0,0 +1,34 @@
1From: =?utf-8?b?T25kxZllaiBTdXLDvQ==?= <ondrej@sury.org>
2Date: Tue, 19 Feb 2019 12:55:42 +0000
3Subject: Use runstatedir for pid file location
4
5We have to modify the autohelled Makefile.in instead of Makefile.am because Kea
6requires old automake-1.15.
7
8Patch-Source: https://sources.debian.org/src/isc-kea/1.5.0-2/debian/patches/0004-Use-runstatedir-for-pid-file-location.patch/
9
10--- a/src/lib/process/Makefile.in
11+++ b/src/lib/process/Makefile.in
12@@ -487,10 +487,8 @@
13 top_builddir = @top_builddir@
14 top_srcdir = @top_srcdir@
15 SUBDIRS = . testutils tests
16-# DATA_DIR is the directory where to put PID files.
17-dhcp_data_dir = @runstatedir@/@PACKAGE@
18 AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib \
19- -DDATA_DIR="\"$(dhcp_data_dir)\"" $(BOOST_INCLUDES)
20+ -DKEA_PIDFILE_DIR="\"$(runstatedir)/$(PACKAGE_NAME)\"" $(BOOST_INCLUDES)
21 AM_CXXFLAGS = $(KEA_CXXFLAGS)
22
23 # Ensure that the message file is included in the distribution
24--- a/src/lib/process/daemon.cc
25+++ b/src/lib/process/daemon.cc
26@@ -37,7 +37,7 @@
27
28 Daemon::Daemon()
29 : signal_set_(), signal_handler_(), config_file_(""),
30- pid_file_dir_(DATA_DIR), pid_file_(), am_file_author_(false) {
31+ pid_file_dir_(KEA_PIDFILE_DIR), pid_file_(), am_file_author_(false) {
32
33 // The pid_file_dir can be overridden via environment variable
34 // This is primarily intended to simplify testing