Skip to content

Instantly share code, notes, and snippets.

@philgs philgs/packages.rb
Created Dec 6, 2015

Embed
What would you like to do?
Chef recipe for re-installing VirtualBox Guest Additions on Fedora 23, so that kernel upgrades will work correctly.
# Recipe:: packages
# --- COPY GUEST ADDITIONS ---
cookbook_file 'guest additions' do
path '/opt/VBoxLinuxAdditions.run'
source 'VBoxLinuxAdditions.run'
mode '0774'
action :create
end
# --- INSTALL DEVELOPER TOOLS ---
script 'install dev tools' do
interpreter "bash"
code <<-EOH
sudo dnf install -y dkms gcc-c++ make kernel-devel
sudo dnf downgrade -y kernel-devel-4.2.3-300.fc23.x86_64
sudo dnf downgrade -y kernel-headers-4.2.3-300.fc23.x86_64
EOH
action :run
only_if { platform_family?('fedora') }
not_if { ::File.exists?( '/usr/bin/gcc' ) }
end
# --- RE-INSTALL GUEST ADDITIONS
execute 'install guest additions' do
command '/opt/VBoxLinuxAdditions.run'
returns [ 0, 1 ]
action :run
not_if { ::File.exists?( '/opt/vbox-guest-additions-guard' ) }
end
file 'guest re-install guard' do
path '/opt/vbox-guest-additions-guard'
action :touch
not_if { ::File.exists?( '/opt/vbox-guest-additions-guard' ) }
end
# --- UPDATE THE PACKAGES ---
execute 'upgrade packages' do
command 'sudo dnf upgrade -y'
action :run
only_if { platform_family?('fedora') }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.