--- /dev/null
+#
+# Cookbook Name:: hardware
+# Recipe:: default
+#
+# Copyright 2012, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:cpu][:"0"][:vendor_id]
+when "GenuineIntel"
+ package "intel-microcode"
+end
+
+if node[:dmi] and node[:dmi][:system]
+ case node[:dmi][:system][:manufacturer]
+ when "empty"
+ manufacturer = node[:dmi][:base_board][:manufacturer]
+ product = node[:dmi][:base_board][:product_name]
+ else
+ manufacturer = node[:dmi][:system][:manufacturer]
+ product = node[:dmi][:system][:product_name]
+ end
+else
+ manufacturer = "Unknown"
+ product = "Unknown"
+end
+
+case manufacturer
+when "HP"
+ package "hponcfg"
+ package "hp-health"
+ package "hpacucli"
+ unit = "1"
+ speed = "115200"
+when "TYAN"
+ unit = "0"
+ speed = "115200"
+when "TYAN Computer Corporation"
+ unit = "0"
+ speed = "115200"
+when "Supermicro"
+ case product
+ when "H8DGU", "X9SCD", "X7DBU", "X7DW3", "X9DR7/E-(J)LN4F", "X9DR3-F"
+ unit = "1"
+ speed = "115200"
+ else
+ unit = "0"
+ speed = "115200"
+ end
+when "IBM"
+ unit = "0"
+ speed = "115200"
+end
+
+if manufacturer == "HP" and node[:lsb][:release].to_f > 11.10
+ git "/opt/hp/hp-legacy" do
+ action :sync
+ repository "git://chef.openstreetmap.org/hp-legacy.git"
+ user "root"
+ group "root"
+ end
+
+ link "/opt/hp/hp-health/bin/hpasmd" do
+ to "/opt/hp/hp-legacy/hpasmd"
+ end
+
+ link "/usr/lib/libhpasmintrfc.so.3.0" do
+ to "/opt/hp/hp-legacy/libhpasmintrfc.so.3.0"
+ end
+
+ link "/usr/lib/libhpasmintrfc.so.3" do
+ to "libhpasmintrfc.so.3.0"
+ end
+
+ link "/usr/lib/libhpasmintrfc.so" do
+ to "libhpasmintrfc.so.3.0"
+ end
+end
+
+unless unit.nil?
+ file "/etc/init/ttySttyS#{unit}.conf" do
+ action :delete
+ end
+
+ template "/etc/init/ttyS#{unit}.conf" do
+ source "tty.conf.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ variables :unit => unit, :speed => speed
+ end
+
+ service "ttyS#{unit}" do
+ provider Chef::Provider::Service::Upstart
+ action [ :enable, :start ]
+ supports :status => true, :restart => true, :reload => false
+ subscribes :restart, resources(:template => "/etc/init/ttyS#{unit}.conf")
+ end
+end
+
+if File.exist?("/etc/default/grub")
+ execute "update-grub" do
+ action :nothing
+ command "/usr/sbin/update-grub"
+ end
+
+ template "/etc/default/grub" do
+ source "grub.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ variables :unit => unit, :speed => speed
+ notifies :run, resources(:execute => "update-grub")
+ end
+end
+
+execute "update-initramfs" do
+ action :nothing
+ command "update-initramfs -u -k all"
+ user "root"
+ group "root"
+end
+
+template "/etc/initramfs-tools/conf.d/mdadm" do
+ source "initramfs-mdadm.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ notifies :run, "execute[update-initramfs]"
+end
+
+if node[:kernel][:modules].include?("mpt2sas")
+ package "sas2ircu"
+ package "sas2ircu-status"
+end
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+# Boot the first entry by default
+GRUB_DEFAULT="0"
+
+# Wait two seconds before booting the default entry
+GRUB_TIMEOUT="2"
+
+# Display the menu straight away
+GRUB_HIDDEN_TIMEOUT="0"
+GRUB_HIDDEN_TIMEOUT_QUIET="true"
+
+# Set the distribution name
+GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
+
+# Arguments to add to the kernel command line (all entries)
+<% if @unit.nil? -%>
+GRUB_CMDLINE_LINUX="nomodeset"
+<% else -%>
+GRUB_CMDLINE_LINUX="console=tty0 console=ttyS<%= @unit %>,115200n8 nomodeset"
+<% end -%>
+
+# Arguments to add to the kernel command line (except recovery entries)
+GRUB_CMDLINE_LINUX_DEFAULT=""
+
+<% if @unit.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"
+<% end -%>
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+# mdadm boot_degraded configuration
+#
+# You can run 'dpkg-reconfigure mdadm' to modify the values in this file, if
+# you want. You can also change the values here and changes will be preserved.
+# Do note that only the values are preserved; the rest of the file is
+# rewritten.
+#
+# BOOT_DEGRADED:
+# Do you want to boot your system if a RAID providing your root filesystem
+# becomes degraded?
+#
+# Running a system with a degraded RAID could result in permanent data loss
+# if it suffers another hardware fault.
+#
+# However, you might answer "yes" if this system is a server, expected to
+# tolerate hardware faults and boot unattended.
+
+BOOT_DEGRADED=true