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