postflight revision 38af808a71423ab14dcdd5f802e36c5797012f90
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Copyright (C) 2007-2010 Oracle Corporation
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# This file is part of VirtualBox Open Source Edition (OSE), as
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# available from http://www.virtualbox.org. This file is free software;
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# you can redistribute it and/or modify it under the terms of the GNU
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# General Public License (GPL) as published by the Free Software
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Foundation, in version 2 as it comes in the "COPYING" file of the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
ead9bb4b1be81d7bbf8ed86ee41d6c1e58b069a3Yuri Pankov# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# Correct the ownership of the directories in case there
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# was an existing installation.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# Select the right architecture.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovfor trg in `ls /Applications/VirtualBox.app/Contents/MacOS/*-${MY_ARCH}`;
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov linkname=`echo "$trg" | sed -e 's|-'"${MY_ARCH}"'$||' `
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# Install the Python bindings
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovVBOX_INSTALL_PATH=/Applications/VirtualBox.app/Contents/MacOS
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovPYTHON="python python2.3 python2.5 python2.6 python2.7"
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovif [ -e "${VBOX_INSTALL_PATH}/sdk/installer/vboxapisetup.py" ]; then
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov # Install the python bindings if python is in the path
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov if [ "`\${p} -c 'print "test"' 2> /dev/null`" = "test" ]; then
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov echo 1>&2 "Python found: ${p}, installing bindings..."
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov # Pass install path via environment
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov /bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py install"
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# Install the vboxweb service file for launchd
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovVBOXWEBSRV="${VBOX_INSTALL_PATH}/org.virtualbox.vboxwebsrv.plist"
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovif [[ -e "${VBOXWEBSRV}" && -e "${VBOXWEBSRV_TRG}" ]]; then
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov echo "Installing vboxwebsrv launchd file to ${VBOXWEBSRV_TRG}"
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov [ "x" != "x${USER}" ] && /usr/sbin/chown "${USER}" "${VBOXWEBSRV_TRG}/org.virtualbox.vboxwebsrv.plist"
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# Install any custom files
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovDATAPATH="`/usr/bin/dirname "${0}"`/../../../../../.."
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovif [ -d "${DATAPATH}/.custom" ]; then
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov echo 1>&2 "Copy ${DATAPATH}/.custom to ${VBOX_INSTALL_PATH}...";
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov ${CPDIR} "${DATAPATH}/.custom/" "${VBOX_INSTALL_PATH}/custom"
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# Register our file extensions
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovLSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovif [[ -e "${LSREGISTER}" && "x" != "x${USER}" ]]; then
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov echo "Register file extensions for \"${USER}\""
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov /usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov /usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app/Contents/Resources/vmstarter.app
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# Restore previously installed Extension Packs (if any)
052519c2d30736afb1861979b73d5a889cf7fba8Garrett D'Amoreif [ -d "${INSTALLER_TEMP}/ExtensionPacks" ]; then
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov cp -r "${INSTALLER_TEMP}/ExtensionPacks" "${VBOX_INSTALL_PATH}"