config_get_bool disabled "$1" 'disabled' 0
[ $disabled = 1 ] && return
- procd_open_instance "$cfg"
- procd_set_param command /usr/sbin/chilli
- procd_set_param file "$chilli_conf"
- procd_append_param command \
- --fg \
- --conf "${base}.conf" \
- --pidfile "${base}.pid" \
- --cmdsocket "${base}.sock" \
- --unixipc "${base}.ipc"
- procd_set_param respawn
- procd_set_param stdout 1
- procd_set_param stderr 1
- procd_close_instance
+ . /lib/functions/network.sh
+
+ local wanif ipaddr
+ if network_find_wan wanif && network_get_ipaddr ipaddr "$wanif"; then
+ procd_open_instance "$cfg"
+ procd_set_param command /usr/sbin/chilli
+ procd_set_param file "$chilli_conf"
+ procd_append_param command \
+ --fg \
+ --conf "${base}.conf" \
+ --pidfile "${base}.pid" \
+ --cmdsocket "${base}.sock" \
+ --unixipc "${base}.ipc"
+ procd_set_param respawn
+ procd_set_param stdout 1
+ procd_set_param stderr 1
+ procd_close_instance
+ fi
}
start_service() {