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