with_gfx=1

gfxmode=auto
locale_dir=$prefix/locale
lang=en_US

search --no-floppy --file /boot/i386/efi --set
prefix=($root)/boot/i386/grub2-efi

insmod efi_gop
insmod gzio
insmod gettext

if [ "$with_gfx" = 1 ] ; then
  insmod gfxterm
  insmod gfxmenu
  insmod png

  echo "Please press 't' to show the boot menu on this console"

  terminal_output gfxterm

  theme=$prefix/themes/openSUSE/theme.txt
  export theme

  loadfont $prefix/unicode.pf2
  loadfont $prefix/themes/openSUSE/DejaVuSans10.pf2
  loadfont $prefix/themes/openSUSE/DejaVuSans12.pf2
  loadfont $prefix/themes/openSUSE/DejaVuSans-Bold14.pf2
fi

if sleep --interruptible 0 ; then
  timeout=60
fi

default=1

menuentry "Boot from Hard Disk" --class opensuse --class gnu-linux --class gnu --class os {
  exit
}

menuentry 'Installation' --class opensuse --class gnu-linux --class gnu --class os {
  set gfxpayload=keep
  echo 'Loading kernel ...'
  linux /boot/i386/loader/linux splash=silent
  echo 'Loading initial ramdisk ...'
  initrd /boot/i386/loader/initrd
}

menuentry 'Upgrade' --class opensuse --class gnu-linux --class gnu --class os {
  set gfxpayload=keep
  echo 'Loading kernel ...'
  linux /boot/i386/loader/linux splash=silent upgrade=1
  echo 'Loading initial ramdisk ...'
  initrd /boot/i386/loader/initrd
}

submenu 'More ...' {

  menuentry 'Rescue System' --class opensuse --class gnu-linux --class gnu {
    set gfxpayload=keep
    echo 'Loading kernel ...'
    linux /boot/i386/loader/linux splash=silent rescue=1
    echo 'Loading initial ramdisk ...'
    initrd /boot/i386/loader/initrd
  }

  menuentry 'Boot Linux System' --class opensuse --class gnu-linux --class gnu {
    set gfxpayload=keep
    echo 'Loading kernel ...'
    linux /boot/i386/loader/linux splash=silent systemboot=1
    echo 'Loading initial ramdisk ...'
    initrd /boot/i386/loader/initrd
  }

  menuentry 'Check Installation Media' --class opensuse --class gnu-linux --class gnu {
    set gfxpayload=keep
    echo 'Loading kernel ...'
    linux /boot/i386/loader/linux splash=silent mediacheck=1
    echo 'Loading initial ramdisk ...'
    initrd /boot/i386/loader/initrd
  }

}

# On EFI systems we can only have graphics *or* serial, so allow the user
# to switch between the two
hiddenentry 'Text mode' --hotkey 't' {
  set textmode=true
  terminal_output console
}