#!/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' }