for isofile in $isopath/elive_*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "Live and Install -- Kernel pae" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=0 quiet splash"
        linux (loop)/live/vmlinuz1 $bootoptions
        initrd (loop)/live/initrd1.img
      }
      menuentry "Live with Saved Sessions (persistence) -- Kernel pae" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=0 quiet splash persistence"
        linux (loop)/live/vmlinuz1 $bootoptions
        initrd (loop)/live/initrd1.img
      }
      menuentry "Install -- Kernel pae" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs loglevel=0 eliveinstaller"
        linux (loop)/live/vmlinuz1 $bootoptions
        initrd (loop)/live/initrd1.img
      }
      menuentry "Graphical Problems -- Kernel pae" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=0 quiet splash vga=normal i915.modeset=0"
        linux (loop)/live/vmlinuz1 $bootoptions
        initrd (loop)/live/initrd1.img
      }
      menuentry "Safemode -- Kernel pae" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs vga=normal b43.blacklist=yes noapic noacpi nomodeset nosmp nolapic nodma noapm nomcefailsafe loglevel=7"
        linux (loop)/live/vmlinuz1 $bootoptions
        initrd (loop)/live/initrd1.img
      }
      menuentry "Console mode without desktop -- Kernel pae" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=0 quiet nox11autologin"
        linux (loop)/live/vmlinuz1 $bootoptions
        initrd (loop)/live/initrd1.img
      }
      menuentry "Debug and Verbose mode -- Kernel pae" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=7 verbose debug nosplash"
        linux (loop)/live/vmlinuz1 $bootoptions
        initrd (loop)/live/initrd1.img
      }
      menuentry "Live and Install -- Legacy Kernel" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=0 quiet splash"
        linux (loop)/live/vmlinuz2 $bootoptions
        initrd (loop)/live/initrd2.img
      }
      menuentry "Live with Saved Sessions (persistence) -- Legacy Kernel" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=0 quiet splash persistence"
        linux (loop)/live/vmlinuz2 $bootoptions
        initrd (loop)/live/initrd2.img
      }
      menuentry "Install -- Legacy Kernel" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs loglevel=0 eliveinstaller"
        linux (loop)/live/vmlinuz2 $bootoptions
        initrd (loop)/live/initrd2.img
      }
      menuentry "Graphical Problems -- Legacy Kernel" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=0 quiet splash vga=normal i915.modeset=0"
        linux (loop)/live/vmlinuz2 $bootoptions
        initrd (loop)/live/initrd2.img
      }
      menuentry "Safemode -- Legacy Kernel" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs vga=normal b43.blacklist=yes noapic noacpi nomodeset nosmp nolapic nodma noapm nomcefailsafe loglevel=7"
        linux (loop)/live/vmlinuz2 $bootoptions
        initrd (loop)/live/initrd2.img
      }
      menuentry "Console mode without desktop -- Legacy Kernel" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=0 quiet nox11autologin"
        linux (loop)/live/vmlinuz2 $bootoptions
        initrd (loop)/live/initrd2.img
      }
      menuentry "Debug and Verbose mode -- Legacy Kernel" {
        bootoptions="findiso=$iso_path username=eliveuser boot=live config components union=aufs modprobe.blacklist=nouveau,radeonhd,radeon,vmwgfx loglevel=7 verbose debug nosplash"
        linux (loop)/live/vmlinuz2 $bootoptions
        initrd (loop)/live/initrd2.img
      }
    }
  fi
done
