#!/sbin/openrc-run
description="Data Safe Restore Client"

DSRDIR="/usr/local/dsr"
DSR="$DSRDIR/dsr"
PIDFILE="$DSRDIR/conf/pid"

command_background="yes"

depend() {
	# net and net-online can be disabled, so we cant trust them...
	need localmount
	after bootmisc
}

start() {
	ebegin "Starting Data Safe Restore"
	mkdir -p "$DSRDIR/conf"
	start-stop-daemon --start --exec "${DSR}" --background --make-pidfile --pidfile "${PIDFILE}"
	eend $?
}

stop() {
	ebegin "Stopping Data Safe Restore"
	start-stop-daemon --stop --pidfile "${PIDFILE}"
	rm -f "${PIDFILE}"
	eend $?
}
