for isofile in $isopath/MX*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "MX" {
        bootoptions="from=hd,usb root=UUID=$rootuuid fromiso=$iso_path quiet"
        linux (loop)/antiX/vmlinuz $bootoptions
        initrd (loop)/antiX/initrd.gz
      }
      menuentry "MX Customize Boot (text menus)" {
        bootoptions="from=hd,usb root=UUID=$rootuuid fromiso=$iso_path quiet menus"
        linux (loop)/antiX/vmlinuz $bootoptions
        initrd (loop)/antiX/initrd.gz
      }
      menuentry "MX Failsafe" {
        bootoptions="from=hd,usb root=UUID=$rootuuid fromiso=$iso_path quiet nomodeset failsafe"
        linux (loop)/antiX/vmlinuz $bootoptions
        initrd (loop)/antiX/initrd.gz
      }
      menuentry "MX Modesetting Video" {
        bootoptions="from=hd,usb root=UUID=$rootuuid fromiso=$iso_path quiet xorg=modesetting"
        linux (loop)/antiX/vmlinuz $bootoptions
        initrd (loop)/antiX/initrd.gz
      }
      menuentry "MX No Xorg Config" {
        bootoptions="from=hd,usb root=UUID=$rootuuid fromiso=$iso_path quiet noxorg"
        linux (loop)/antiX/vmlinuz $bootoptions
        initrd (loop)/antiX/initrd.gz
      }
    }
  fi
done
