summaryrefslogtreecommitdiff
path: root/net-dns/knot/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-dns/knot/files
reinit the tree, so we can have metadata
Diffstat (limited to 'net-dns/knot/files')
-rw-r--r--net-dns/knot/files/2.5.3-link-with-libatomic.patch117
-rw-r--r--net-dns/knot/files/knot-1.service17
-rw-r--r--net-dns/knot/files/knot.init41
-rw-r--r--net-dns/knot/files/knot.service14
4 files changed, 189 insertions, 0 deletions
diff --git a/net-dns/knot/files/2.5.3-link-with-libatomic.patch b/net-dns/knot/files/2.5.3-link-with-libatomic.patch
new file mode 100644
index 000000000000..14e5366f7d94
--- /dev/null
+++ b/net-dns/knot/files/2.5.3-link-with-libatomic.patch
@@ -0,0 +1,117 @@
+From 5cf2d1acf87fa0ab18375534ca210f1cabf212b3 Mon Sep 17 00:00:00 2001
+From: Pierre-Olivier Mercier <nemunaire@nemunai.re>
+Date: Wed, 2 Aug 2017 23:16:43 +0200
+Subject: [PATCH] Link with libatomic on architectures that requires it
+
+---
+ configure.ac | 10 +++++++++-
+ src/Makefile.am | 2 +-
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2a28214..5bd1798 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -504,8 +504,16 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sched.h>]], [[cpuset_t* set = cpuset
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <stdint.h>]],
+ [[uint64_t val = 0; __atomic_add_fetch(&val, 1, __ATOMIC_RELAXED);]])],
+- [AC_DEFINE(HAVE_ATOMIC, 1, [Define to 1 if you have '__atomic' functions.])]
++ [AC_DEFINE(HAVE_ATOMIC, 1, [Define to 1 if you have '__atomic' functions.])
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM([[#include <stdint.h>]],
++ [[uint64_t val = 0; __atomic_add_fetch(&val, 1, __ATOMIC_RELAXED);]])],
++ [atomic_LIBS=""],
++ [atomic_LIBS="-latomic"]
++ )],
++ [atomic_LIBS=""]
+ )
++AC_SUBST([atomic_LIBS])
+
+ # Prepare CFLAG_VISIBILITY to be used where needed
+ gl_VISIBILITY()
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 948912e..bf28013 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -399,7 +399,7 @@ libknotd_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(systemd_CFLAGS) \
+ $(liburcu_CFLAGS) -DKNOTD_MOD_STATIC
+ libknotd_la_LDFLAGS = $(AM_LDFLAGS) -export-symbols-regex '^knotd_'
+ libknotd_la_LIBADD = libknot.la zscanner/libzscanner.la $(systemd_LIBS) \
+- $(liburcu_LIBS)
++ $(liburcu_LIBS) $(atomic_LIBS)
+
+ ###################
+ # Knot DNS Daemon #
+--- a/src/Makefile.in 2017-08-05 18:09:14.029882010 +0200
++++ b/src/Makefile.in 2017-08-05 18:12:43.541190937 +0200
+@@ -379,7 +379,7 @@
+ @STATIC_MODULE_dnstap_TRUE@ contrib/dnstap/libdnstap.la
+ libknotd_la_DEPENDENCIES = libknot.la zscanner/libzscanner.la \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+- $(am__DEPENDENCIES_2)
++ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+ am__libknotd_la_SOURCES_DIST = knot/conf/base.c knot/conf/base.h \
+ knot/conf/conf.c knot/conf/conf.h knot/conf/confdb.c \
+ knot/conf/confdb.h knot/conf/confio.c knot/conf/confio.h \
+@@ -937,6 +937,7 @@
+ am__quote = @am__quote@
+ am__tar = @am__tar@
+ am__untar = @am__untar@
++atomic_LIBS = @atomic_LIBS@
+ bindir = @bindir@
+ build = @build@
+ build_alias = @build_alias@
+@@ -1275,7 +1276,8 @@
+ $(am__append_11)
+ libknotd_la_LDFLAGS = $(AM_LDFLAGS) -export-symbols-regex '^knotd_'
+ libknotd_la_LIBADD = libknot.la zscanner/libzscanner.la \
+- $(systemd_LIBS) $(liburcu_LIBS) $(am__append_12)
++ $(systemd_LIBS) $(liburcu_LIBS) $(atomic_LIBS) \
++ $(am__append_12)
+ @HAVE_DAEMON_TRUE@sbin_SCRIPTS = utils/pykeymgr/pykeymgr
+ @HAVE_DAEMON_TRUE@CLEAN_FILES = $(sbin_SCRIPTS)
+ @HAVE_DAEMON_TRUE@knotddir = $(includedir)/knot
+--- a/configure 2017-08-05 18:09:14.039882551 +0200
++++ b/configure 2017-08-05 18:12:18.779857706 +0200
+@@ -655,6 +655,7 @@
+ CODE_COVERAGE_ENABLED_TRUE
+ HAVE_VISIBILITY
+ CFLAG_VISIBILITY
++atomic_LIBS
+ libidn_LIBS
+ libidn_CFLAGS
+ libidn2_LIBS
+@@ -16347,10 +16358,32 @@
+
+ $as_echo "#define HAVE_ATOMIC 1" >>confdefs.h
+
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#include <stdint.h>
++int
++main ()
++{
++uint64_t val = 0; __atomic_add_fetch(&val, 1, __ATOMIC_RELAXED);
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++ atomic_LIBS=""
++else
++ atomic_LIBS="-latomic"
++
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++else
++ atomic_LIBS=""
+
+ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
++
+ # Prepare CFLAG_VISIBILITY to be used where needed
+
+
diff --git a/net-dns/knot/files/knot-1.service b/net-dns/knot/files/knot-1.service
new file mode 100644
index 000000000000..14a34a2b211f
--- /dev/null
+++ b/net-dns/knot/files/knot-1.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Knot high-performance DNS Server
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/knotd
+ExecReload=/usr/sbin/knotc reload
+ExecStop=/usr/sbin/knotc stop
+PrivateTmp=true
+User=knot
+Group=knot
+RuntimeDirectory=knot
+RuntimeDirectoryMode=750
+AmbientCapabilities=CAP_NET_BIND_SERVICE
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-dns/knot/files/knot.init b/net-dns/knot/files/knot.init
new file mode 100644
index 000000000000..8dc460c31cd4
--- /dev/null
+++ b/net-dns/knot/files/knot.init
@@ -0,0 +1,41 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command=/usr/sbin/knotd
+command_args="-d"
+pidfile=/var/run/knot/knot.pid
+required_files=/etc/knot/knot.conf
+extra_started_commands="reload"
+description_reload="Reload configuration and changed zones."
+
+depend() {
+ need net
+}
+
+start() {
+ checkpath -d -m 0750 -o knot:knot /var/run/knot/ /var/lib/knot/
+
+ ebegin "Starting knot"
+ start-stop-daemon --start \
+ --pidfile $pidfile --exec $command -- $command_args
+ eend $?
+}
+
+stop() {
+ ebegin "Stoping knot"
+ /usr/sbin/knotc stop >/dev/null 2>&1
+ # In case remote control is not working
+ if [ "$?" != 0 ]; then
+ if [ -f $pidfile ]; then
+ start-stop-daemon --stop --pidfile $pidfile
+ fi
+ fi
+ ewend $?
+}
+
+reload() {
+ ebegin "Reloading knot"
+ /usr/sbin/knotc reload >/dev/null
+ eend $?
+}
diff --git a/net-dns/knot/files/knot.service b/net-dns/knot/files/knot.service
new file mode 100644
index 000000000000..4684f9c858e2
--- /dev/null
+++ b/net-dns/knot/files/knot.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Knot high-performance DNS Server
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/knotd
+ExecReload=/usr/sbin/knotc reload
+ExecStop=/usr/sbin/knotc stop
+PrivateTmp=true
+RuntimeDirectory=knot
+RuntimeDirectoryMode=750
+
+[Install]
+WantedBy=multi-user.target