postflight revision 01892aaba1ec28bb5179c9f32b3fa79e49e59df9
306N/A#!/bin/sh
306N/A
306N/A#
306N/A# Copyright (C) 2007-2010 Oracle Corporation
306N/A#
306N/A# This file is part of VirtualBox Open Source Edition (OSE), as
306N/A# available from http://www.virtualbox.org. This file is free software;
306N/A# you can redistribute it and/or modify it under the terms of the GNU
306N/A# General Public License (GPL) as published by the Free Software
306N/A# Foundation, in version 2 as it comes in the "COPYING" file of the
306N/A# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
306N/A# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
306N/A#
306N/A
306N/ACP="/bin/cp -f"
306N/ACPDIR="${CP} -R"
306N/A
306N/A#
306N/A# Correct the ownership of the directories in case there
306N/A# was an existing installation.
306N/A#
306N/Achown -R root:admin /Applications/VirtualBox.app
306N/A
306N/A#
306N/A# Select the right architecture.
306N/A#
306N/AMY_ARCH=`uname -m`
306N/Aif test "$MY_ARCH" = "x86_64"; then
306N/A MY_ARCH="amd64"
306N/Aelse
306N/A MY_ARCH="x86"
493N/Afi
493N/Aset -e
306N/Afor trg in `ls /Applications/VirtualBox.app/Contents/MacOS/*-${MY_ARCH}`;
493N/Ado
306N/A linkname=`echo "$trg" | sed -e 's|-'"${MY_ARCH}"'$||' `
493N/A if test "$linkname" = "$trg"; then
493N/A echo "oops: $trg" 1>&2
493N/A exit 1;
493N/A fi
493N/A rm -f "$linkname"
493N/A ln -vh "$trg" "$linkname"
493N/Adone
306N/A
306N/A#
493N/A# Install the Python bindings
306N/A#
306N/A
561N/AVBOX_INSTALL_PATH=/Applications/VirtualBox.app/Contents/MacOS
306N/APYTHON="python python2.3 python2.5 python2.6"
306N/Aif [ -e "${VBOX_INSTALL_PATH}/sdk/installer/vboxapisetup.py" ]; then
306N/A for p in $PYTHON; do
306N/A # Install the python bindings if python is in the path
306N/A if [ "`\${p} -c 'print "test"' 2> /dev/null`" = "test" ]; then
306N/A echo 1>&2 "Python found: ${p}, installing bindings..."
636N/A # Pass install path via environment
636N/A export VBOX_INSTALL_PATH
636N/A /bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py install 2> /dev/null"
636N/A fi
636N/A done
636N/Afi
#
# Install the vboxweb service file for launchd
#
VBOXWEBSRV="${VBOX_INSTALL_PATH}/org.virtualbox.vboxwebsrv.plist"
VBOXWEBSRV_TRG="${HOME}/Library/LaunchAgents"
if [[ -e "${VBOXWEBSRV}" && -e "${VBOXWEBSRV_TRG}" ]]; then
echo "Installing vboxwebsrv launchd file to ${VBOXWEBSRV_TRG}"
${CP} "${VBOXWEBSRV}" "${VBOXWEBSRV_TRG}/"
/usr/sbin/chown "${USER}" "${VBOXWEBSRV_TRG}/org.virtualbox.vboxwebsrv.plist"
fi
#
# Install any custom files
#
DATAPATH="`/usr/bin/dirname "${0}"`/../../../../../.."
if [ -d "${DATAPATH}/.custom" ]; then
echo 1>&2 "Copy ${DATAPATH}/.custom to ${VBOX_INSTALL_PATH}...";
${CPDIR} "${DATAPATH}/.custom/" "${VBOX_INSTALL_PATH}/custom"
fi
#
# Register our file extensions
#
LSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
if [ -e ${LSREGISTER} ]; then
echo "Register file extensions for $USER"
/usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app
/usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app/Contents/Resources/vmstarter.app
fi
exit 0;