net-misc/kea: Revbump to add an openrc init script.

Permission kindly granted by Chainsaw.

Package-Manager: Portage-2.3.6, Repoman-2.3.2
This commit is contained in:
Lars Wendler
2017-05-23 14:57:37 +02:00
parent 26e468fdc8
commit 934a6a343e
3 changed files with 93 additions and 7 deletions

View File

@@ -0,0 +1,4 @@
# Which services should be taken into account?
DHCP4="true"
DHCP6="false"
DDNS="false"

View File

@@ -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
}

View File

@@ -1,9 +1,9 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI="6"
EAPI=6
inherit eutils toolchain-funcs user
inherit toolchain-funcs user
MY_PV="${PV//_alpha/a}"
MY_PV="${MY_PV//_beta/b}"
@@ -40,16 +40,20 @@ src_prepare() {
}
src_configure() {
econf \
$(use_with openssl) \
$(use_enable samples install-configurations) \
--disable-static \
local myeconfargs=(
$(use_with openssl)
$(use_enable samples install-configurations)
--disable-static
--without-werror
)
econf "${myeconfargs[@]}"
}
src_install() {
default
prune_libtool_files --all
newconfd "${FILESDIR}"/${PN}-confd ${PN}
newinitd "${FILESDIR}"/${PN}-initd ${PN}
find "${ED}" \( -name "*.a" -o -name "*.la" \) -delete || die
}
pkg_preinst() {