Reputation: 666
I tried googling this but got 5000 hits on people using vagrant with virtualbox..
Since my virtualbox has machines requiring USB support I need the extension pack installed.
I need to have puppet install my extension pack file.
I currently have this for VirtualBox:
class virtualbox(
$ubuntu_release
) {
apt::source { virtualbox:
location => 'http://download.virtualbox.org/virtualbox/debian',
release => $ubuntu_release,
repos => 'contrib',
key => '98AB5139',
key_source => "http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc",
include_src => false,
}
package { virtualbox:
name => 'virtualbox-4.2',
ensure => present,
require => Apt::Source['virtualbox']
}
}
Do anyone have a way to install the extension pack ? Im afraid if I do an exec I have no way of checking if I actually installed the pack or what version it is on so it will just keep reinstalling. And since the extension pack updates everytime there is a new VirtualBox version I need to be able to update it as well ..
Here's the current command(s) to install the pack.
wget -nv http://download.virtualbox.org/virtualbox/4.2.10/Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack -P /tmp && VBoxManage extpack install /tmp/Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack --replace
I tried doing something like having a version of the extension pack in a file:
class vbox_extension {
$packagever = "4210"
$packagefile = "/var/log/puppet/vbox_extension.ver"
exec { "vboxinst":
command => "wget -nv http://download.virtualbox.org/virtualbox/4.2.10/Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack -P /tmp \
&& VBoxManage extpack install /tmp/Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack --replace \
&& echo \"$packagever\" > \"$packagefile\"",",
unless => "test \"`cat $packagefile 2>/dev/null`\" = \"$packagever\"",
require => virtualbox
}
}
But is this really the cleanest way to do this ?
Upvotes: 1
Views: 1758
Reputation: 666
I decided to create a debian package of this instead as we are running our own repo anyway.
Running this on Ubuntu 12.10 for a 12.04 system.
Here's the steps:
Be root..
sudo su
You need FPM, FPM needs rubygems to install.
apt-get install rubygems
gem install fpm
And run this:
mkdir -p /opt/vbext
cd /opt/vbext
wget -nv http://download.virtualbox.org/virtualbox/4.2.10/Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack
cat <<EOF> /opt/vbext/installpack
#/bin/bash
VBoxManage extpack install /opt/vbext/Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack --replace
EOF
cat <<EOF> /opt/vbext/removepack
#/bin/bash
vboxmanage extpack uninstall "Oracle VM VirtualBox Extension Pack"
EOF
chmod +x installpack removepack
fpm -t deb -n extpack -v 4.2.10-84104 -d virtualbox-4.2 --after-install installpack --after-remove removepack -s dir /opt/vbext/
You will now have a neatly packaged debian package.
ls /opt/vbext/*.deb
extpack_4.2.10-84104_amd64.deb
FPM supports templating the scripts but I'm to lazy to put that in right now..
Upvotes: 2