product = "Unknown"
end
+units = []
+
+if node[:roles].include?("bytemark")
+ units << "0"
+end
+
case manufacturer
when "HP"
package "hponcfg"
package "hp-health"
- unit = "1"
- speed = "115200"
+ units << "1"
when "TYAN"
- unit = "0"
- speed = "115200"
+ units << "0"
when "TYAN Computer Corporation"
- unit = "0"
- speed = "115200"
+ units << "0"
when "Supermicro"
case product
when "H8DGU", "X9SCD", "X7DBU", "X7DW3", "X9DR7/E-(J)LN4F", "X9DR3-F", "X9DRW"
- unit = "1"
- speed = "115200"
+ units << "1"
else
- unit = "0"
- speed = "115200"
+ units << "0"
end
when "IBM"
- unit = "0"
- speed = "115200"
+ units << "0"
end
-unless unit.nil?
+units.sort.uniq.each do |unit|
file "/etc/init/ttySttyS#{unit}.conf" do
action :delete
end
owner "root"
group "root"
mode 0644
- variables :unit => unit, :speed => speed
+ variables :unit => unit
end
service "ttyS#{unit}" do
owner "root"
group "root"
mode 0644
- variables :unit => unit, :speed => speed, :entry => grub_entry
+ variables :units => units, :entry => grub_entry
notifies :run, "execute[update-grub]"
end
end
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)
# 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 -%>
<% 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 -%>
stop on runlevel [!2345]
respawn
-exec /sbin/getty -L <%= @speed %> ttyS<%= @unit %> vt102
+exec /sbin/getty -L 115200 ttyS<%= @unit %> vt102