#!/bin/sh

# PROVIDE: vfs_quota
# REQUIRE: FILESYSTEMS
# BEFORE:  LOGIN

. /etc/rc.subr

name="vfs_quota"
rcvar=`set_rcvar`
start_cmd="vq_start"

vq_start()
{
	if checkyesno vfs_quota_enable; then
		# For each dir in $vfs_quota_sync, run vquota sync
		#
		case ${vfs_quota_sync} in
		[Nn][Oo] | '')
			;;
		*)
			echo -n 'Synchronizing VFS counters: '
			for dir in ${vfs_quota_sync}; do
				echo -n "${dir} "
				if [ -d "${dir}" ]; then
					/sbin/vquota sync ${dir}
				fi
			done
			echo '.'
			;;
		esac
	fi
}

load_rc_config $name
run_rc_command "$1"
