1 | #!/bin/sh
|
---|
2 | # $Id: postflight 54685 2015-03-07 22:59:38Z vboxsync $
|
---|
3 | ## @file
|
---|
4 | # Post installation script.
|
---|
5 | #
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Copyright (C) 2007-2015 Oracle Corporation
|
---|
9 | #
|
---|
10 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | # available from http://www.virtualbox.org. This file is free software;
|
---|
12 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | # General Public License (GPL) as published by the Free Software
|
---|
14 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | #
|
---|
18 |
|
---|
19 | CP="/bin/cp -f"
|
---|
20 | CPDIR="${CP} -R"
|
---|
21 |
|
---|
22 |
|
---|
23 | #
|
---|
24 | # Install the Python bindings
|
---|
25 | #
|
---|
26 |
|
---|
27 | VBOX_INSTALL_PATH=/Applications/VirtualBox.app/Contents/MacOS
|
---|
28 | PYTHON="python python2.3 python2.5 python2.6 python2.7"
|
---|
29 | if [ -e "${VBOX_INSTALL_PATH}/sdk/installer/vboxapisetup.py" ]; then
|
---|
30 | for p in $PYTHON; do
|
---|
31 | # Install the python bindings if python is in the path
|
---|
32 | if [ "`\${p} -c 'print "test"' 2> /dev/null`" = "test" ]; then
|
---|
33 | echo 1>&2 "Python found: ${p}, installing bindings..."
|
---|
34 | # Pass install path via environment
|
---|
35 | export VBOX_INSTALL_PATH
|
---|
36 | /bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py install"
|
---|
37 | /bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py clean --all"
|
---|
38 | fi
|
---|
39 | done
|
---|
40 | fi
|
---|
41 |
|
---|
42 | #
|
---|
43 | # Install the vboxweb service file for launchd
|
---|
44 | #
|
---|
45 | VBOXWEBSRV="${VBOX_INSTALL_PATH}/org.virtualbox.vboxwebsrv.plist"
|
---|
46 | VBOXWEBSRV_TRG="${HOME}/Library/LaunchAgents"
|
---|
47 | if [[ -e "${VBOXWEBSRV}" && -e "${VBOXWEBSRV_TRG}" ]]; then
|
---|
48 | echo "Installing vboxwebsrv launchd file to ${VBOXWEBSRV_TRG}"
|
---|
49 | ${CP} "${VBOXWEBSRV}" "${VBOXWEBSRV_TRG}/"
|
---|
50 | [ "x" != "x${USER}" ] && /usr/sbin/chown "${USER}" "${VBOXWEBSRV_TRG}/org.virtualbox.vboxwebsrv.plist"
|
---|
51 | fi
|
---|
52 |
|
---|
53 | #
|
---|
54 | # Install any custom files
|
---|
55 | #
|
---|
56 | DATAPATH="`/usr/bin/dirname "${0}"`/../../../../../.."
|
---|
57 | if [ -d "${DATAPATH}/.custom" ]; then
|
---|
58 | echo 1>&2 "Copy ${DATAPATH}/.custom to ${VBOX_INSTALL_PATH}...";
|
---|
59 | ${CPDIR} "${DATAPATH}/.custom/" "${VBOX_INSTALL_PATH}/custom"
|
---|
60 | fi
|
---|
61 |
|
---|
62 | #
|
---|
63 | # Register our file extensions
|
---|
64 | #
|
---|
65 | LSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
|
---|
66 | if [[ -e "${LSREGISTER}" && "x" != "x${USER}" ]]; then
|
---|
67 | echo "Register file extensions for \"${USER}\""
|
---|
68 | /usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app
|
---|
69 | /usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app/Contents/Resources/vmstarter.app
|
---|
70 | fi
|
---|
71 |
|
---|
72 | # Check environment.
|
---|
73 | if [ "${INSTALLER_TEMP}x" == "x" ]; then
|
---|
74 | echo "Required environment variable INSTALLER_TEMP is missing. Aborting installation."
|
---|
75 | exit 1;
|
---|
76 | fi
|
---|
77 |
|
---|
78 | # Restore previously installed Extension Packs (if any)
|
---|
79 | if [ -d "${INSTALLER_TEMP}/ExtensionPacks" ]; then
|
---|
80 | cp -r "${INSTALLER_TEMP}/ExtensionPacks" "${VBOX_INSTALL_PATH}"
|
---|
81 | rm -rf "${INSTALLER_TEMP}/ExtensionPacks"
|
---|
82 | fi
|
---|
83 |
|
---|
84 | #
|
---|
85 | # Correct the ownership of the directories in case there
|
---|
86 | # was an existing installation.
|
---|
87 | #
|
---|
88 | chown -R root:admin /Applications/VirtualBox.app
|
---|
89 |
|
---|
90 | exit 0;
|
---|
91 |
|
---|