VirtualBox

source: vbox/trunk/src/VBox/Installer/darwin/VirtualBox/postflight@ 35650

Last change on this file since 35650 was 34275, checked in by vboxsync, 14 years ago

FE/Qt4; Installer-OSX; Resources: add handling of file type association

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
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
15CP="/bin/cp -f"
16CPDIR="${CP} -R"
17
18#
19# Correct the ownership of the directories in case there
20# was an existing installation.
21#
22chown -R root:admin /Applications/VirtualBox.app
23
24#
25# Select the right architecture.
26#
27MY_ARCH=`uname -m`
28if test "$MY_ARCH" = "x86_64"; then
29 MY_ARCH="amd64"
30else
31 MY_ARCH="x86"
32fi
33set -e
34for trg in `ls /Applications/VirtualBox.app/Contents/MacOS/*-${MY_ARCH}`;
35do
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"
43done
44
45#
46# Install the Python bindings
47#
48
49VBOX_INSTALL_PATH=/Applications/VirtualBox.app/Contents/MacOS
50PYTHON="python python2.3 python2.5 python2.6"
51if [ -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
61fi
62
63#
64# Install the vboxweb service file for launchd
65#
66VBOXWEBSRV="${VBOX_INSTALL_PATH}/org.virtualbox.vboxwebsrv.plist"
67VBOXWEBSRV_TRG="${HOME}/Library/LaunchAgents"
68if [[ -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"
72fi
73
74#
75# Install any custom files
76#
77DATAPATH="`/usr/bin/dirname "${0}"`/../../../../../.."
78if [ -d "${DATAPATH}/.custom" ]; then
79 echo 1>&2 "Copy ${DATAPATH}/.custom to ${VBOX_INSTALL_PATH}...";
80 ${CPDIR} "${DATAPATH}/.custom/" "${VBOX_INSTALL_PATH}/custom"
81fi
82
83#
84# Register our file extensions
85#
86LSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
87if [ -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
91fi
92
93exit 0;
94
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette