for isofile in $isopath/gnewsense-live-*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      menuentry "Live gNewSense" {
        bootoptions="findiso=$iso_path boot=live config quiet splash"
        linux (loop)/live/vmlinuz $bootoptions
        initrd (loop)/live/initrd.img
      }
      menuentry "Live gNewSense (failsafe)" {
        bootoptions="findiso=$iso_path boot=live config memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal"
        linux (loop)/live/vmlinuz $bootoptions
        initrd (loop)/live/initrd.img
      }
    }
  fi
done

