#!/bin/sh /etc/rc.common
# SecuBox TFTP Recovery Server
# Provides network-based bare-metal recovery

START=96
STOP=10
USE_PROCD=1

PROG=/usr/sbin/secubox-tftp-recovery

start_service() {
	# Check if enabled in config
	local enabled=$(uci -q get secubox.tftp_recovery.enabled)
	[ "$enabled" != "1" ] && return 0

	procd_open_instance
	procd_set_param command $PROG start
	procd_set_param respawn
	procd_set_param stdout 1
	procd_set_param stderr 1
	procd_close_instance
}

stop_service() {
	$PROG stop
}

status() {
	$PROG status
}

reload_service() {
	stop
	start
}
