#!/sbin/openrc-run
supervisor=supervise-daemon

name="RMTFS"
description="Qualcomm remote file system service"

command="/usr/bin/rmtfs"

if [ -z "$command_args" ]; then
	# -s: enable sync for the mss rproc instance
	# Basically: start/stop modem remoteproc together with rmtfs
	command_args="-s"

	if [ -z "$rmtfs_files_path" ]; then
		command_args="$command_args -P"
	else
		command_args="$command_args -o $rmtfs_files_path"
	fi

	if [ "$rmtfs_avoid_writing" = "true" ]; then
		command_args="$command_args -r"
	fi
fi

# https://github.com/andersson/rmtfs/commit/dfb8f3ed1c8fbde621cd08aaf9e7724a4c55cbd1
respawn_delay=1

depend() {
	before networkmanager ofono modemmanager
	after udev-settle
	use qrtr-ns
}
