for isofile in $isopath/pfSense-*-amd64.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "pfSense" {
        bootoptions="$iso_path type=mfs_root"
        kfreebsd (loop)/boot/kernel/kernel.gz
        kfreebsd_module $bootoptions
        set kFreeBSD.vfs.root.mountfrom=cd9660:/dev/md0
        set kFreeBSD.vfs.root.mountfrom.options=ro
        set kFreeBSD.grub.platform=$grub_platform
      }
    }
  fi
done
