#!/bin/sh /etc/rc.common
|
|
# Copyright (C) 2016 OpenWrt.org
|
|
|
|
START=98
|
|
STOP=20
|
|
PROG=/usr/bin/knxd
|
|
USE_PROCD=1
|
|
|
|
append_bool() {
|
|
local section="$1"
|
|
local option="$2"
|
|
local value="$3"
|
|
local _loctmp
|
|
local default="$4"
|
|
config_get_bool _loctmp "$section" "$option"
|
|
[ -z "$_loctmp" ] && _loctmp="$default"
|
|
[ "$_loctmp" -gt 0 ] && append params "--$value"
|
|
}
|
|
|
|
append_parm() {
|
|
local section="$1"
|
|
local option="$2"
|
|
local switch="$3"
|
|
local _loctmp
|
|
local default="$4"
|
|
config_get _loctmp "$section" "$option"
|
|
[ -z "$_loctmp" ] && _loctmp="$default"
|
|
[ -z "$_loctmp" ] && return 0
|
|
append params "--$switch=$_loctmp"
|
|
}
|
|
|
|
start_service() {
|
|
local options url
|
|
config_load knxd
|
|
append_parm args eibaddr "eibaddr" "0.0.1"
|
|
append_parm args layer2 "layer2"
|
|
append_bool args GroupCache "GroupCache" 0
|
|
append_parm args daemon "daemon" "/var/log/knxd.log"
|
|
append_bool args Discovery "Discovery" 1
|
|
append_parm args error "error" # "5"
|
|
append_parm args listen_tcp "listen-tcp" "6720"
|
|
append_bool args no_emisend_queuing "no-emisend-queuing" 0
|
|
append_parm args Name "Name" "OpenWrt"
|
|
append_bool args no_tunnel_client_queuing "no-tunnel-client-queuing" 0
|
|
append_bool args no_monitor "no-monitor" 0
|
|
append_bool args Routing "Routing" 0
|
|
append_parm args trace "trace" # "7"
|
|
append_bool args tpuarts_ack_all_group "tpuarts-ack-all-group" 0
|
|
append_bool args tpuarts_ack_all_individual "tpuarts-ack-all-individual" 0
|
|
append_bool args tpuarts_disch_reset "tpuarts-disch-reset" 0
|
|
append_bool args Tunnelling "Tunnelling" 1
|
|
append_bool args Server "Server" 1
|
|
append_parm args listen_local "listen-local" "/var/run/knxd"
|
|
config_get url args url
|
|
procd_open_instance
|
|
procd_set_param command $PROG $params $url
|
|
procd_set_param respawn
|
|
procd_close_instance
|
|
}
|
|
|
|
stop_service() {
|
|
killall knxd
|
|
}
|
|
|
|
reload_service()
|
|
{
|
|
restart
|
|
}
|
|
|
|
service_triggers()
|
|
{
|
|
procd_add_reload_trigger knxd
|
|
}
|