Create a gist now

Instantly share code, notes, and snippets.

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