mirror of
https://github.com/openwrt/packages.git
synced 2026-05-31 06:51:51 +08:00
cdf8efa263
Add Mesthastic daemon and web interface. Co-authored-by: Austin Lane <vidplace7@gmail.com> Signed-off-by: George Sapkin <george@sapk.in>
45 lines
940 B
Bash
45 lines
940 B
Bash
#!/bin/sh /etc/rc.common
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
# shellcheck shell=busybox
|
|
|
|
START=99
|
|
STOP=10
|
|
|
|
USE_PROCD=1
|
|
PROG=/usr/bin/meshtasticd
|
|
|
|
start_service() {
|
|
config_load 'meshtastic'
|
|
|
|
local config_dir data_dir
|
|
|
|
uci_validate_section 'meshtasticd' 'meshtasticd' 'meshtasticd' \
|
|
'config_dir:string:/etc/meshtasticd' \
|
|
'data_dir:string:/var/lib/meshtasticd'
|
|
|
|
local config_file="${config_dir}/config.yaml"
|
|
local config_d_dir="${config_dir}/config.d/*"
|
|
|
|
mkdir -p "$data_dir"
|
|
|
|
# meshtasticd needs to be run from its data directory
|
|
cd "$data_dir"
|
|
|
|
procd_open_instance
|
|
procd_set_param command "$PROG"
|
|
procd_append_param command --fsdir="$data_dir"
|
|
procd_set_param file "$config_file"
|
|
procd_set_param file "$config_d_dir"
|
|
procd_set_param term_timeout 15
|
|
procd_set_param respawn
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
}
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger 'meshtasticd'
|
|
}
|