for isofile in $isopath/Redcore*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      loopback loop "$iso_path"
      probe --label --set=cd_label (loop)
      menuentry "Start Redcore" {
        bootoptions="iso-scan/filename=$iso_path rd.live.image root=live:CDLABEL=$cd_label rootfstype=auto vconsole.keymap=us rd.locale.LANG=en_US.utf8 loglevel=1 console=tty0 rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0 splash quiet --"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/initrd
      }
      menuentry "Start Redcore (VirtualBox safe graphic)" {
        bootoptions="iso-scan/filename=$iso_path rd.live.image root=live:CDLABEL=$cd_label rootfstype=auto vconsole.keymap=us rd.locale.LANG=en_US.utf8 modprobe.blacklist=vboxvideo loglevel=1 console=tty0 rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0 splash quiet --"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/initrd
      }
      menuentry "Start Redcore (Disable ACPI)" {
        bootoptions="iso-scan/filename=$iso_path rd.live.image root=live:CDLABEL=$cd_label rootfstype=auto vconsole.keymap=us rd.locale.LANG=en_US.utf8 modprobe.blacklist=vboxvideo loglevel=1 console=tty0 rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0 splash quiet noacpi acpi=off --"
        linux (loop)/boot/vmlinuz $bootoptions
        initrd (loop)/boot/initrd
      }
    }
  fi
done
