VirtualBox Install part two.

137 views
Skip to first unread message

Paul Bloch

unread,
Sep 8, 2011, 5:27:34 PM9/8/11
to munk...@googlegroups.com
Now that I can successfully install Virtualbox, I need to install
VirtualBox extensions.  The way you do that is by running a VirtualBox
command with the extension file after VirtualBox is installed.

VBoxManage extpack install <tarball>

It seems like a Munki postinstall script as documented in the wiki
<http://code.google.com/p/munki/wiki/PreAndPostinstallScripts> is the
right way to do that.  I can just put the extension pack on the server
and the Munki postinstall script would load it.  The extension pack
needs to be the one for the current version of VirtualBox, so is there
anyway for my postinstall script to use get the VirtualBox version
from the Munki pkgsinfo plist?

        <key>name</key>
        <string>VirtualBox</string>
        <key>version</key>
        <string>4.1.2</string>

So my postinstall script would be

        #!/bin/sh

        VBoxManage=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage
        # Get version from Munki pkgsinfo plist
        ExtensionPack=/nfs/Installers/Apps/Oracle/Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack

        ${VBoxManage} extpack install ${ExtensionPack}

I guess I can get the info from the install VirtualBox using `pkgutil`.

% pkgutil --pkg-info org.virtualbox.pkg.virtualbox | awk '/version/{print $2}'
4.1.2

Paul

Greg Neagle

unread,
Sep 8, 2011, 5:32:05 PM9/8/11
to munk...@googlegroups.com
How about

# defaults read /Applications/VirtualBox.app/Contents/Info CFBundleShortVersionString
4.1.2

Of course, since the postinstall script is _in_ the pkginfo, you already know the version...

-Greg

Paul Bloch

unread,
Sep 8, 2011, 5:46:05 PM9/8/11
to munk...@googlegroups.com
Thanks. It's true that I know the version when I am editing the
pkginfo; I just was thinking ahead to the next version of VirtualBox
and hoping to not have to remember to change the version number in the
postinstall script. I was thinking that since Munki knows the version
from the pkginfo when it calls the postinstall script, it might be
available in the environment.

Using `defaults read` is probably faster than using `pkgutil` and
`awk`. So I'll probably go that way.

I'm a new Munki user and haven't quite gotten all the ins and outs sorted yet.

Paul

Greg Neagle

unread,
Sep 8, 2011, 5:50:51 PM9/8/11
to munk...@googlegroups.com
While this approach may be valid for and work in your environment, it would not be my recommended approach, as it relies on network connectivity to your NFS share to get the tarballs.

My recommended approach would be to create one or more "payload-free" packages that used a postflight script to install the extensions. The extension(s) would be included in the package contents, so they'd be sure to be available on the machine at time to install.

But creating "payload-free" packages is a skill of its own.

-Greg

Jason Hueske

unread,
Sep 8, 2011, 5:57:17 PM9/8/11
to munk...@googlegroups.com
The next thing you'll run into is how to verify that the ext pack is actually fully installed. You could copy_from_dmg the tarball as is to a permanent destination before it is actually "installed" to VBox via munki postinstall_script and rely on that, but that will only determine whether you've cached the tarball (which you then have to leave lying there), not whether the subsequent "installation" from it to your VBox was actually successful.

So besides those versions, you'll also have to manually increment whatever it is you'll end up using as a proper installs key for the extension pack, e.g.:

md5 -q /Applications/VirtualBox.app/Contents/MacOS/ExtensionPacks/Oracle_VM_VirtualBox_Extension_Pack/ExtPack.xml

<key>installs</key>
<array>
<dict>
<key>md5checksum</key>
<string>cd5b3d5070e2ec4c885f85cd517b6569</string>
<key>path</key>
<string>/Applications/VirtualBox.app/Contents/MacOS/ExtensionPacks/Oracle_VM_VirtualBox_Extension_Pack/ExtPack.xml</string>
<key>type</key>
<string>file</string>
</dict>
</array>

In the end there was so much fiddling associated with maintaining the Vbox/extpack pkginfo in general, that I ended up using a separate shell script dedicated just to handle its particular pkginfo creation, incrementing version numbers, md5, etc. It's not the only package I ended up doing that for, and it's not always pretty, but for these odd duck cases it's been my strategy so far.

- Jason

Reply all
Reply to author
Forward
0 new messages