for isofile in $isopath/rancheros*.iso; do
  if [ -e "$isofile" ]; then
    regexp --set=isoname "$isopath/(.*)" "$isofile"
    submenu "$isoname ->" "$isofile" {
      iso_path="$2"
      insmod regexp
      loopback loop "$iso_path"
      root=(loop)
      menuentry "RancherOS" {
        bootoptions="rancher.autologin=tty1 rancher.autologin=ttyS0 console=tty0 console=ttyS0 printk.devkmsg=on"
        linux /boot/vmlinuz-* $bootoptions
        initrd /boot/initrd-*
      }
    }
  fi
done
