for isofile in $isopath/NetBSD-*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "NetBSD" {
        bootoptions=""
        knetbsd (loop)/netbsd $bootoptions
        knetbsd_module_elf (loop)/*/installation/miniroot/miniroot.kmod
      }
      menuentry "NetBSD (no ACPI)" {
        bootoptions="-2"
        knetbsd (loop)/netbsd $bootoptions
        knetbsd_module_elf (loop)/*/installation/miniroot/miniroot.kmod
      }
      menuentry "NetBSD (no ACPI, no SMP)" {
        bootoptions="-12"
        knetbsd (loop)/netbsd $bootoptions
        knetbsd_module_elf (loop)/*/installation/miniroot/miniroot.kmod
      }
    }
  fi
done
