for isofile in $isopath/clonezilla-live-*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "Clonezilla live (Default settings, VGA 1024x768)" {
        bootoptions="findiso=$iso_path boot=live union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid locales= keyboard-layouts= ocs_live_run='ocs-live-general' ocs_live_extra_param='' ocs_live_batch=no vga=791 ip= net.ifnames=0  nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1"
        linux (loop)/live/vmlinuz $bootoptions
        initrd (loop)/live/initrd.img
      }
      menuentry "Clonezilla live (Default settings, VGA 800x600)" {
        bootoptions="findiso=$iso_path boot=live union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid locales= keyboard-layouts= ocs_live_run='ocs-live-general' ocs_live_extra_param='' ocs_live_batch=no vga=788 ip= net.ifnames=0  nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1"
        linux (loop)/live/vmlinuz $bootoptions
        initrd (loop)/live/initrd.img
      }
      menuentry "Clonezilla live (Default settings, VGA 640x480)" {
        bootoptions="findiso=$iso_path boot=live union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid locales= keyboard-layouts= ocs_live_run='ocs-live-general' ocs_live_extra_param='' ocs_live_batch=no vga=785 ip= net.ifnames=0  nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1"
        linux (loop)/live/vmlinuz $bootoptions
        initrd (loop)/live/initrd.img
      }
      menuentry "Clonezilla live KMS" {
        bootoptions="findiso=$iso_path boot=live union=overlay username=user config components quiet noswap edd=on nodmraid locales= keyboard-layouts= ocs_live_run='ocs-live-general' ocs_live_extra_param='' ocs_live_batch=no vga=791 ip= net.ifnames=0  nosplash"
        linux (loop)/live/vmlinuz $bootoptions
        initrd (loop)/live/initrd.img
      }
      menuentry "Clonezilla live (To RAM)" {
        bootoptions="findiso=$iso_path boot=live union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid locales= keyboard-layouts= ocs_live_run='ocs-live-general' ocs_live_extra_param='' ocs_live_batch=no vga=788 toram=filesystem.squashfs ip= net.ifnames=0  nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1"
        linux (loop)/live/vmlinuz $bootoptions
        initrd (loop)/live/initrd.img
      }
      menuentry "Clonezilla live without framebuffer" {
        bootoptions="findiso=$iso_path boot=live union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid locales= keyboard-layouts= ocs_live_run='ocs-live-general' ocs_live_extra_param='' ocs_live_batch=no ip= net.ifnames=0 nomodeset vga=normal nosplash"
        linux (loop)/live/vmlinuz $bootoptions
        initrd (loop)/live/initrd.img
      }
      menuentry "Clonezilla live failsafe mode" {
        bootoptions="findiso=$iso_path boot=live union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid locales= keyboard-layouts= ocs_live_run='ocs-live-general' ocs_live_extra_param='' ocs_live_batch=no acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp ip= net.ifnames=0 nomodeset vga=normal nosplash"
        linux (loop)/live/vmlinuz $bootoptions
        initrd (loop)/live/initrd.img
      }
      submenu "Memtest & FreeDOS ->" {
        menuentry "Memory test using Memtest86+" {
          bootoptions=""
          linux16 (loop)/live/memtest $bootoptions
        }
        menuentry "FreeDOS" {
          bootoptions=""
          linux16 (loop)/syslinux/memdisk $bootoptions
          initrd16 (loop)/live/freedos.img
        }
      }
      menuentry "iPXE" {
        bootoptions=""
        linux16 (loop)/live/ipxe.lkn $bootoptions
      }
    }
  fi
done
