#!/usr/local/bin/cbsd
#v10.0.3
MYARG="jroot fstab"
MYOPTARG=""
MYDESC="Unmount jail by fstab file"

. ${subrdir}/nc.subr
. ${cbsdinit}

[ ! -f "${fstab}" ] && err 1 "No fstab"
[ ! -d "${jroot}" ] && err 1 "Wrong jroot $jroot"

/usr/bin/tail -r ${fstab} | while read _device _mountpt _fs _mode _a _b; do
	case ":${_device}" in
		:#* | :)
			continue
			;;
	esac
	/sbin/umount -f ${jroot}${_mountpt}
done
