Skip to content

Instantly share code, notes, and snippets.

@gondoi
Created August 2, 2011 16:19
Show Gist options
  • Save gondoi/1120554 to your computer and use it in GitHub Desktop.
Save gondoi/1120554 to your computer and use it in GitHub Desktop.
grab kernel version
default[:kernel][:newinstall] = "default"
package "kernel-xen"
log("Detected kernel installed: #{node[:kernel][:newinstall]}") { level :debug }
ruby_block "find_installed_kernel_ver" do
block do
node.set[:kernel][:newinstall] = %x[cd /boot && ls -t vmlinuz*].split('vmlinuz-')[1].strip
Chef::Log.debug("#{node[:kernel][:newinstall]}")
end
end
log("Detected kernel installed: #{node[:kernel][:newinstall]}") { level :debug }
template "/boot/grub/grub.conf" do
source "grub.conf.erb"
end
default=0
timeout=5
title=<%= node[:platform] %> (<%= node[:kernel][:newinstall] %>)
root (hd0)
kernel /boot/vmlinuz-<%= node[:kernel][:newinstall] %> ro console=hvc0 root=/dev/xvda1
initrd /boot/initrd-<%= node[:kernel][:newinstall] %>.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment