X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/d1be18e9426db54d3cf367855ee95fd8ed117e3b..ab47927c016597f8602b81dcdc168ad5c335389d:/cookbooks/hardware/templates/default/grub.erb?ds=inline diff --git a/cookbooks/hardware/templates/default/grub.erb b/cookbooks/hardware/templates/default/grub.erb index d69a870b9..305a5b0b0 100644 --- a/cookbooks/hardware/templates/default/grub.erb +++ b/cookbooks/hardware/templates/default/grub.erb @@ -2,22 +2,7 @@ # 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 %> +GRUB_DEFAULT="<%= @entry %>" # Wait two seconds before booting the default entry GRUB_TIMEOUT="2" @@ -30,10 +15,10 @@ GRUB_HIDDEN_TIMEOUT_QUIET="true" GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` # Arguments to add to the kernel command line (all entries) -<% if @unit.nil? -%> +<% if @units.nil? -%> GRUB_CMDLINE_LINUX="<%= node[:hardware][:grub][:cmdline].join(" ") %>" <% else -%> -GRUB_CMDLINE_LINUX="console=tty0 console=ttyS<%= @unit %>,115200n8 <%= node[:hardware][:grub][:cmdline].join(" ") %>" +GRUB_CMDLINE_LINUX="console=tty0 <%= @units.sort.uniq.collect { |unit| "console=ttyS#{unit},115200n8" }.join(" ") %> <%= node[:hardware][:grub][:cmdline].join(" ") %>" <% end -%> # Arguments to add to the kernel command line (except recovery entries) @@ -42,18 +27,13 @@ GRUB_CMDLINE_LINUX_DEFAULT="panic=30" # Do not wait for infinite time on a failed boot GRUB_RECORDFAIL_TIMEOUT=2 -<% if @unit.nil? -%> +<% if @units.nil? -%> # Send console output to the screen GRUB_TERMINAL="console" <% else -%> -<% if node[:lsb][:release].to_f >= 12.04 -%> # Send console output to the screen and serial port GRUB_TERMINAL="console serial" -<% else -%> -# Send console output to the serial port -GRUB_TERMINAL="serial" -<% end -%> # Configure the serial console -GRUB_SERIAL_COMMAND="serial --speed=<%= @speed %> --unit=<%= @unit %> --word=8 --parity=no --stop=1" +GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=<%= @units.first %> --word=8 --parity=no --stop=1" <% end -%>