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