summaryrefslogtreecommitdiff
path: root/net-misc/kea/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-misc/kea/files
reinit the tree, so we can have metadata
Diffstat (limited to 'net-misc/kea/files')
-rw-r--r--net-misc/kea/files/kea-confd4
-rw-r--r--net-misc/kea/files/kea-initd78
2 files changed, 82 insertions, 0 deletions
diff --git a/net-misc/kea/files/kea-confd b/net-misc/kea/files/kea-confd
new file mode 100644
index 000000000000..568468eb3a1d
--- /dev/null
+++ b/net-misc/kea/files/kea-confd
@@ -0,0 +1,4 @@
+# Which services should be taken into account?
+DHCP4="true"
+DHCP6="false"
+DDNS="false"
diff --git a/net-misc/kea/files/kea-initd b/net-misc/kea/files/kea-initd
new file mode 100644
index 000000000000..85fdd56b9ec2
--- /dev/null
+++ b/net-misc/kea/files/kea-initd
@@ -0,0 +1,78 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="kea dhcp services"
+
+dhcp4_command="/usr/sbin/kea-dhcp4"
+dhcp6_command="/usr/sbin/kea-dhcp6"
+ddns_command="/usr/sbin/kea-dhcp-ddns"
+config_file="/etc/kea/kea.conf"
+dhcp4_pidfile="/run/kea-dhcp4.pid"
+dhcp6_pidfile="/run/kea-dhcp6.pid"
+ddns_pidfile="/run/kea-ddns.pid"
+
+depend() {
+ use net
+}
+
+start_pre() {
+ if [ ! -f "${config_file}" ] ; then
+ eerror "Please create a ${config_file} config file."
+ return 1
+ fi
+
+ if ${DHCP4:-false} ; then
+ if ! ${dhcp4_command} -t ${config_file} 1>/dev/null 2>/dev/null ; then
+ eerror "Error in config file."
+ return 1
+ fi
+ fi
+ if ${DHCP6:-false} ; then
+ if ! ${dhcp6_command} -t ${config_file} 1>/dev/null 2>/dev/null ; then
+ eerror "Error in config file."
+ return 1
+ fi
+ fi
+ if ${DDNS:-false} ; then
+ if ! ${ddns_command} -t ${config_file} 1>/dev/null 2>/dev/null ; then
+ eerror "Error in config file."
+ return 1
+ fi
+ fi
+}
+
+start() {
+ einfo "Starting kea dhcp services"
+ if ${DHCP4:-false} ; then
+ start-stop-daemon -m -b -p ${dhcp4_pidfile} \
+ -x ${dhcp4_command} -- -c ${config_file} \
+ || return 1
+ fi
+ if ${DHCP6:-false} ; then
+ start-stop-daemon -m -b -p ${dhcp6_pidfile} \
+ -x ${dhcp6_command} -- -c ${config_file} \
+ || return 1
+ fi
+ if ${DDNS:-false} ; then
+ start-stop-daemon -m -b -p ${ddns_pidfile} \
+ -x ${ddns_command} -- -c ${config_file} \
+ || return 1
+ fi
+}
+
+stop() {
+ einfo "Stopping kea dhcp services"
+ if ${DHCP4:-false} ; then
+ start-stop-daemon --stop -p ${dhcp4_pidfile} \
+ || return 1
+ fi
+ if ${DHCP6:-false} ; then
+ start-stop-daemon --stop -p ${dhcp6_pidfile} \
+ || return 1
+ fi
+ if ${DDNS:-false} ; then
+ start-stop-daemon --stop -p ${ddns_pidfile} \
+ || return 1
+ fi
+}