for isofile in $isopath/pclinuxos64-*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "LiveCD" {
        bootoptions="root=UUID=$rootuuid bootfromiso=$iso_path livecd=livecd vga=788 keyb=us quiet splash=silent"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.gz
      }
      menuentry "LiveCD - No Boot Splash" {
        bootoptions="root=UUID=$rootuuid bootfromiso=$iso_path livecd=livecd vga=788 keyb=us quiet splash=verbose"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.gz
      }
      menuentry "Video safe mode - VESA" {
        bootoptions="root=UUID=$rootuuid bootfromiso=$iso_path livecd=livecd vga=788 keyb=us quiet splash=silent xdriver=vesa"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.gz
      }
      menuentry "Safe boot" {
        bootoptions="root=UUID=$rootuuid bootfromiso=$iso_path livecd=livecd acpi=off vga=normal keyb=us noapic nolapic nopinit xdriver=vesa"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.gz
      }
      menuentry "Console" {
        bootoptions="root=UUID=$rootuuid bootfromiso=$iso_path livecd=livecd 3 vga=788 keyb=us quiet splash=silent"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.gz
      }
      menuentry "Video safe mode - VESA" {
        bootoptions="root=UUID=$rootuuid bootfromiso=$iso_path livecd=livecd copy2ram vga=788 keyb=us quiet splash=verbose"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.gz
      }
      menuentry "Install PCLinuxOS" {
        bootoptions="root=UUID=$rootuuid bootfromiso=$iso_path livecd=livecd vga=788 keyb=us quiet splash=silent install"
        linux (loop)/isolinux/vmlinuz $bootoptions
        initrd (loop)/isolinux/initrd.gz
      }
    }
  fi
done
