# Agama generated grub2 config file
set btrfs_relative_path="y"
export btrfs_relative_path
set default=0
if [ -n "$extra_cmdline" ]; then
  submenu "Bootable snapshot $snapshot_num" {
    menuentry "If OK, run snapper rollback and reboot." { true; }
  }
fi
if [ -n "${iso_path}" ]; then
    isoboot="iso-scan/filename=${iso_path}"
fi
set timeout=60
set timeout_style=menu
if [ "${grub_platform}" = "efi" ]; then
    echo "Please press 't' to show the boot menu on this console"
fi
set gfxmode=auto
set font=($root)/boot/x86_64/loader/grub2/fonts/unicode.pf2
set ascii_font=grub2/themes/openSUSE/ascii.pf2
set sans_bold_14_font=grub2/themes/openSUSE/DejaVuSans-Bold14.pf2
set sans_10_font=grub2/themes/openSUSE/DejaVuSans10.pf2
set sans_12_font=grub2/themes/openSUSE/DejaVuSans12.pf2
if [ -f ${font} ];then
    loadfont ${font}
fi
if [ -f ($root)/boot/${ascii_font} ];then
    loadfont ($root)/boot/${ascii_font}
fi
if [ -f ($root)/boot/${sans_bold_14_font} ];then
    loadfont ($root)/boot/${sans_bold_14_font}
fi
if [ -f ($root)/boot/${sans_10_font} ];then
    loadfont ($root)/boot/${sans_10_font}
fi
if [ -f ($root)/boot/${sans_12_font} ];then
    loadfont ($root)/boot/${sans_12_font}
fi
if [ -f ($root)/boot/grub2/themes/openSUSE/theme.txt ];then
    set theme=($root)/boot/grub2/themes/openSUSE/theme.txt
fi
terminal_input console
terminal_output gfxterm
if [ "${grub_platform}" != "efi" ]; then
  menuentry "Boot from Hard Disk" --class opensuse --class gnu-linux --class gnu --class os {
    exit
  }
fi
menuentry "Install Leap 16.0 (x86_64)" --class os --unrestricted {
    set gfxpayload=keep
    echo Loading kernel...
    linux ($root)/boot/x86_64/loader/linux ${extra_cmdline} ${isoboot} splash=silent
    echo Loading initrd...
    initrd ($root)/boot/x86_64/loader/initrd
}
menuentry "Failsafe -- Install Leap 16.0 (x86_64)" --class os --unrestricted {
    set gfxpayload=keep
    echo Loading kernel...
    linux ($root)/boot/x86_64/loader/linux ${extra_cmdline} ${isoboot} ide=nodma apm=off noresume edd=off nomodeset 3
    echo Loading initrd...
    initrd ($root)/boot/x86_64/loader/initrd
}
menuentry "Check Installation Medium" --class os --unrestricted {
    set gfxpayload=keep
    echo Loading kernel...
    linux ($root)/boot/x86_64/loader/linux mediacheck=1 plymouth.enable=0 ${isoboot}
    echo Loading initrd...
    initrd ($root)/boot/x86_64/loader/initrd
}
menuentry "Rescue System" --class os --unrestricted {
    set gfxpayload=keep
    echo Loading kernel...
    linux ($root)/boot/x86_64/loader/linux ${extra_cmdline} ${isoboot} systemd.unit=multi-user.target systemd.mask=agama.service systemd.mask=agama-dbus-monitor.service systemd.mask=agama-ssh-issue.service systemd.mask=agama-avahi-issue.service systemd.mask=agama-welcome-issue.service systemd.mask=agama-url-issue.service systemd.mask=agama-certificate-issue.service systemd.mask=agama-certificate-issue.path systemd.mask=agama-certificate-wait.service
    echo Loading initrd...
    initrd ($root)/boot/x86_64/loader/initrd
}

if [ -f "/.snapshots/grub-snapshot.cfg" ]; then
    source "/.snapshots/grub-snapshot.cfg"
fi
if [ "${grub_platform}" = "efi" ]; then
    hiddenentry "Text mode" --hotkey "t" {
        set textmode=true
        terminal_output console
    }
    menuentry "UEFI Firmware Settings" {
        fwsetup --is-supported
        if [ "0" = 0 ]; then
            fwsetup
        else
            echo "Your firmware doesn't support setup menu entry from a boot loader"
            echo "Press any key to return ..."
            read
        fi
    }
fi
