#!/bin/sh

# PROVIDE: resident
# REQUIRE: mountcritremote

. /etc/rc.subr

name=resident
rcvar='resident_enable'
required_files="/etc/resident.conf"
start_cmd="resident_start"
stop_cmd=":"

resident_start()
{
	if [ ! -f /etc/resident.conf ]; then
		return
	fi

	while read path; do
		case ${path} in
		\#*|"")
			;;
		*)
			if [ -f ${path} ]; then
				resident ${path}
			else
				file ${path} | grep shared | \
				    cut -f1 -d ':' -s | xargs resident
			fi
			;;
		esac
	done < /etc/resident.conf
}

load_rc_config $name
run_rc_command "$1"
