for isofile in $isopath/CorePlus-*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "Boot Core Plus with default FLWM topside" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps desktop=flwm_topside"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core Plus with Joe's Window Manager" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps desktop=jwm"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core Plus with ICE Window Manager" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps desktop=icewm"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core Plus with Fluxbox Window Manager" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps desktop=fluxbox"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core Plus with Hackedbox Window Manager" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps desktop=hackedbox"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core Plus with Openbox Window Manager" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps desktop=openbox"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core Plus with FLWM Classic Window Manager" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps desktop=flwm"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core with only X/GUI (TinyCore)" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps lst=xbase.lst base desktop=flwm_topside"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core with X/GUI (TinyCore) + Installation Extension" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps lst=xibase.lst base desktop=flwm_topside"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core with X/GUI (TinyCore) + Wifi + Firmware" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 cde showapps lst=xfbase.lst base desktop=flwm_topside"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core to command line only" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 base"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
      menuentry "Boot Core without embedded extensions with waitusb=5" {
        bootoptions="iso=UUID=$rootuuid/$iso_path loglevel=3 waitusb=5"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/core.gz
      }
    }
  fi
done
