Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use kernel release for package name on saucy and newer #35

Merged
merged 3 commits into from Jan 2, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 13 additions & 10 deletions recipes/aufs.rb
@@ -1,16 +1,19 @@
case node['platform']
when 'ubuntu'
#
# The below code copied from: https://github.com/thoward/docker-cookbook/blob/master/recipes/default.rb
# It's not pretty, but gets the job done!
#
# If aufs isn't available, do our best to install the correct
# linux-image-extra package. This is somewhat messy because the
# naming of these packages is very inconsistent across kernel
# versions
extra_package = Mixlib::ShellOut.new("apt-cache search linux-image-extra-`uname -r | grep --only-matching -e [0-9]\.[0-9]\.[0-9]-[0-9]*` | cut -d ' ' -f 1").run_command.stdout.strip
# If aufs isn't available, do our best to install the correct linux-image-extra package.
# Use kernel release for saucy and newer, otherwise use older, more compatible regexp match
if Gem::Version.new(node['platform_version']) < Gem::Version('13.10')
# Original method copied from https://github.com/thoward/docker-cookbook/blob/master/recipes/default.rb
package_name = 'linux-image-extra-' + Mixlib::ShellOut.new("uname -r | grep --only-matching -e [0-9]\.[0-9]\.[0-9]-[0-9]*").run_command.stdout.strip
else
# In modern ubuntu versions, kernel release matches the kernel package name
package_name = 'linux-image-extra-' + node['kernel']['release']
end

extra_package = Mixlib::ShellOut.new('apt-cache search ' + package_name).run_command.stdout.split(' ').first
# Wait to strip until after checking for empty, to protect against nil errors
unless extra_package.empty?
package extra_package do
package extra_package.strip do
not_if 'modprobe -l | grep aufs'
end
end
Expand Down