packages/net/kea/files/kea.init
Stijn Tintel 3649ed721d kea: add kea-uci package with basic init script
This init script allows to start the Kea Control Agent, the DHCPv4
server, the DHCPv6 server, and the DHCP-DDNS server. It expects the
config files to be where the packages install them.

As this is a single init script that can start 4 different binaries that
are each in their own package, these files cannot be included in any of
these other package, so create a dedicated package for it.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2021-08-16 20:41:51 +03:00

41 lines
773 B
Bash
Executable file

#!/bin/sh /etc/rc.common
USE_PROCD=1
START=25
STOP=85
BIN_PATH="/usr/sbin"
CONF_PATH="/etc/kea"
start_service() {
config_load "kea"
config_foreach start_kea "service"
}
start_kea() {
local cfg="$1"
config_get_bool disabled "$cfg" disabled 0
[ "$disabled" = "0" ] || return
config_get name "$cfg" name "$cfg"
case "$name" in
ctrl_agent|dhcp4|dhcp6|dhcp_ddns)
name="${name/_/-}"
cmd="${BIN_PATH}/kea-${name}"
cnf="${CONF_PATH}/kea-${name}.conf"
;;
*)
return 0
esac
procd_open_instance "$name"
procd_set_param command "$cmd" -c "$cnf"
procd_set_param env KEA_LOCKFILE_DIR=/tmp
procd_append_param env KEA_PIDFILE_DIR=/tmp
procd_set_param file "$cnf"
procd_set_param stderr 1
procd_set_param stdout 1
procd_close_instance ctrl_agent
}