local src fstype mount_opts
src=$1
fstype=${2:-auto}
mount_opts=${3:-loop,ro}
[[ -e $src ]] || die "Image not found: ${(qqq)src}"

defvar build_dir $DO:h/work/$TARGET
defvar prev_fstab ''
eval $(getvars build_dir prev_fstab)

mkdir -p $build_dir \
	|| die "Failed to create build directory ${(qqq)build_dir}"

fstab-add-and-mount "$src:A	${build_dir:A}	$fstype	$mount_opts	0 0"
# vim: fileencoding=utf8 ft=zsh noet sw=4 ts=4 sts=4