fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#!/bin/sh
f0594027c29f947df7aa1f81931a73d658d84159vboxsync# $Id$
f0594027c29f947df7aa1f81931a73d658d84159vboxsync## @file
f0594027c29f947df7aa1f81931a73d658d84159vboxsync# Post installation script.
f0594027c29f947df7aa1f81931a73d658d84159vboxsync#
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#
f0594027c29f947df7aa1f81931a73d658d84159vboxsync# Copyright (C) 2007-2015 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#
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync# Install the Python bindings
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncVBOX_INSTALL_PATH=/Applications/VirtualBox.app/Contents/MacOS
9b10a0dc976004b32777e56bfd39d2d2f36ee0favboxsyncPYTHON="python python2.3 python2.5 python2.6 python2.7"
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
9b10a0dc976004b32777e56bfd39d2d2f36ee0favboxsync /bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py install"
0a7b1f3c2b35ebaf3145256644b6b28db030dc4fvboxsync /bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py clean --all"
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
fee08718516f8d163b37116a4b027d414c81110evboxsync# Check environment.
fee08718516f8d163b37116a4b027d414c81110evboxsyncif [ "${INSTALLER_TEMP}x" == "x" ]; then
fee08718516f8d163b37116a4b027d414c81110evboxsync echo "Required environment variable INSTALLER_TEMP is missing. Aborting installation."
fee08718516f8d163b37116a4b027d414c81110evboxsync exit 1;
fee08718516f8d163b37116a4b027d414c81110evboxsyncfi
fee08718516f8d163b37116a4b027d414c81110evboxsync
38af808a71423ab14dcdd5f802e36c5797012f90vboxsync# Restore previously installed Extension Packs (if any)
38af808a71423ab14dcdd5f802e36c5797012f90vboxsyncif [ -d "${INSTALLER_TEMP}/ExtensionPacks" ]; then
38af808a71423ab14dcdd5f802e36c5797012f90vboxsync cp -r "${INSTALLER_TEMP}/ExtensionPacks" "${VBOX_INSTALL_PATH}"
38af808a71423ab14dcdd5f802e36c5797012f90vboxsync rm -rf "${INSTALLER_TEMP}/ExtensionPacks"
38af808a71423ab14dcdd5f802e36c5797012f90vboxsyncfi
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync
fee08718516f8d163b37116a4b027d414c81110evboxsync#
fee08718516f8d163b37116a4b027d414c81110evboxsync# Correct the ownership of the directories in case there
fee08718516f8d163b37116a4b027d414c81110evboxsync# was an existing installation.
fee08718516f8d163b37116a4b027d414c81110evboxsync#
fee08718516f8d163b37116a4b027d414c81110evboxsyncchown -R root:admin /Applications/VirtualBox.app
fee08718516f8d163b37116a4b027d414c81110evboxsync
38af808a71423ab14dcdd5f802e36c5797012f90vboxsyncexit 0;
f0594027c29f947df7aa1f81931a73d658d84159vboxsync