mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 19:02:09 +00:00
kea: add support synthesizing imported config files
Configuring Kea JSON files is not trivial, and this might impede the adoption of Kea as a DHCP server. There are, however, many users who used its predecessor ISC-DHCP, at least for DHCPv4. A filter could ingest the legacy UCI and synthesize a JSON config file for Kea DHCPv4. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=kea
|
||||
PKG_VERSION:=3.0.2
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://ftp.isc.org/isc/kea/$(PKG_VERSION)
|
||||
@@ -260,6 +260,8 @@ define Package/kea-uci/install
|
||||
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_CONF) ./files/kea.config $(1)/etc/config/kea
|
||||
$(INSTALL_BIN) ./files/kea.init $(1)/etc/init.d/kea
|
||||
$(INSTALL_DIR) $(1)/usr/lib/kea/importers
|
||||
$(INSTALL_BIN) ./files/dhcp4.sh $(1)/usr/lib/kea/importers/
|
||||
endef
|
||||
|
||||
define Package/kea-uci/conffiles
|
||||
|
||||
@@ -4,6 +4,7 @@ USE_PROCD=1
|
||||
START=25
|
||||
STOP=85
|
||||
|
||||
LIB_PATH="/usr/lib/kea"
|
||||
BIN_PATH="/usr/sbin"
|
||||
CONF_PATH="/etc/kea"
|
||||
|
||||
@@ -16,6 +17,7 @@ start_service() {
|
||||
|
||||
start_kea() {
|
||||
local cfg="$1"
|
||||
local name cmd cnf importer
|
||||
|
||||
config_get_bool disabled "$cfg" disabled 0
|
||||
[ "$disabled" = "0" ] || return
|
||||
@@ -24,9 +26,6 @@ start_kea() {
|
||||
|
||||
case "$name" in
|
||||
ctrl_agent|dhcp4|dhcp6|dhcp_ddns)
|
||||
name="${name/_/-}"
|
||||
cmd="${BIN_PATH}/kea-${name}"
|
||||
cnf="${CONF_PATH}/kea-${name}.conf"
|
||||
;;
|
||||
*)
|
||||
echo "Error: Invalid service name '$name'" >&2
|
||||
@@ -34,6 +33,18 @@ start_kea() {
|
||||
;;
|
||||
esac
|
||||
|
||||
name="${name/_/-}"
|
||||
cmd="${BIN_PATH}/kea-${name}"
|
||||
cnf="${CONF_PATH}/kea-${name}.conf"
|
||||
importer="${LIB_PATH}/importers/${name}.sh"
|
||||
|
||||
if [ -f "$importer" ]; then
|
||||
if ! "$importer" "$cnf"; then
|
||||
echo "Error: Importer '$importer' failed; aborting." >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
procd_open_instance "$name"
|
||||
procd_set_param command "$cmd" -c "$cnf"
|
||||
procd_set_param env KEA_LOCKFILE_DIR=/tmp
|
||||
|
||||
Reference in New Issue
Block a user