for isofile in $isopath/Remix_OS_for_PC_Android_*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "Remix OS Live Resident mode - All your data and apps are saved" {
        bootoptions="iso-scan/filename=$iso_path androidboot.selinux=permissive quiet CREATE_DATA_IMG=1"
        linux (loop)/kernel $bootoptions
        initrd (loop)/initrd.img
      }
      menuentry "Remix OS Live Guest mode - No data will be saved after each session" {
        bootoptions="iso-scan/filename=$iso_path androidboot.selinux=permissive quiet DATA_IN_MEM=1"
        linux (loop)/kernel $bootoptions
        initrd (loop)/initrd.img
      }
      menuentry "Remix OS Live Verbose Mode - Save log files for debugging" {
        bootoptions="iso-scan/filename=$iso_path androidboot.selinux=permissive quiet CREATE_DATA_IMG=1 SAVE_LOGS=1"
        linux (loop)/kernel $bootoptions
        initrd (loop)/initrd.img
      }
    }
  fi
done

