0
0
mirror of https://github.com/openwrt/packages.git synced 2025-01-31 03:41:44 +00:00
packages/net/esp2net/files/esp2net.init
Nuno Gonçalves 597df3585f esp2net: add Espressif ESP chip USB-Network proxy
Signed-off-by: Nuno Gonçalves <nunojpg@gmail.com>
2023-10-08 17:40:50 +01:00

33 lines
666 B
Bash
Executable File

#!/bin/sh /etc/rc.common
USE_PROCD=1
START=95
STOP=01
CONFIGURATION=esp2net
SECTION=esp2net
parse_esp2net()
{
local uart
local port
local disabled
config_get uart "${1}" uart
config_get port "${1}" port
config_get_bool disabled "${1}" disabled 0
[ "$disabled" -eq 1 ] && return;
procd_open_instance
procd_set_param respawn 3600 5 5
procd_set_param command /usr/sbin/esp2net "$uart" "$port"
procd_set_param file /etc/config/esp2net
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
start_service() {
config_load "${CONFIGURATION}"
config_foreach parse_esp2net "${SECTION}"
}