#!/usr/bin/env cbsd
#v10.0.3
CIXARG="jroot fstab"
CIXOPTARG=""
MYDESC="Unmount jail by fstab file"

. ${subrdir}/nc.subr
cixinit

[ ! -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

exit 0
