for isofile in $isopath/rhel-server-*-x86_64-*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "Install Red Hat Enterprise Linux" {
        bootoptions="inst.repo=hd:UUID=$rootuuid:$iso_path quiet"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.img
      }
      menuentry "Test this media & install Red Hat Enterprise Linux" {
        bootoptions="inst.repo=hd:UUID=$rootuuid:$iso_path rd.live.check quiet"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.img
      }
      menuentry "Install Red Hat Enterprise Linux in basic graphics mode" {
        bootoptions="inst.repo=hd:UUID=$rootuuid:$iso_path xdriver=vesa nomodeset quiet"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.img
      }
      menuentry "Rescue a Red Hat Enterprise Linux system" {
        bootoptions="inst.repo=hd:UUID=$rootuuid:$iso_path rescue quiet"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.img
      }
    }
  fi
done
