# DO NOT EDIT - This file is being maintained by Chef
-# Boot the first entry by default
+# Boot the first entry by default, unless we have configured
+# it to boot a specific version.
+<% if node[:hardware][:grub][:kernel] == :latest %>
GRUB_DEFAULT="0"
+<% else
+ df = Mixlib::ShellOut.new("df /boot/grub/grub.cfg | tail -n 1 | awk '{print $1;}'")
+ df.run_command
+ df.error!
+ root=df.stdout
+
+ blkid = Mixlib::ShellOut.new("blkid -o value -s UUID #{root}")
+ blkid.run_command
+ blkid.error!
+ uuid=blkid.stdout
+
+ version="#{node[:hardware][:grub][:kernel]}-generic" %>
+GRUB_DEFAULT="gnulinux-advanced-<%= uuid %>>gnulinux-<%= version %>-advanced-<%= uuid %>"
+<% end %>
# Wait two seconds before booting the default entry
GRUB_TIMEOUT="2"
# Arguments to add to the kernel command line (all entries)
<% if @unit.nil? -%>
-GRUB_CMDLINE_LINUX="nomodeset"
+GRUB_CMDLINE_LINUX="<%= node[:hardware][:grub][:cmdline].join(" ") %>"
<% else -%>
-GRUB_CMDLINE_LINUX="console=tty0 console=ttyS<%= @unit %>,115200n8 nomodeset"
+GRUB_CMDLINE_LINUX="console=tty0 console=ttyS<%= @unit %>,115200n8 <%= node[:hardware][:grub][:cmdline].join(" ") %>"
<% end -%>
# Arguments to add to the kernel command line (except recovery entries)
-GRUB_CMDLINE_LINUX_DEFAULT=""
+GRUB_CMDLINE_LINUX_DEFAULT="panic=30"
+
+# Do not wait for infinite time on a failed boot
+GRUB_RECORDFAIL_TIMEOUT=2
<% if @unit.nil? -%>
# Send console output to the screen