VirtualBox

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

Last change on this file since 55998 was 54685, checked in by vboxsync, 10 years ago

Installer/darwin: Clean up python build directory after installation, otherwise we'll end up breaking the bundle signature.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
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
19CP="/bin/cp -f"
20CPDIR="${CP} -R"
21
22
23#
24# Install the Python bindings
25#
26
27VBOX_INSTALL_PATH=/Applications/VirtualBox.app/Contents/MacOS
28PYTHON="python python2.3 python2.5 python2.6 python2.7"
29if [ -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
40fi
41
42#
43# Install the vboxweb service file for launchd
44#
45VBOXWEBSRV="${VBOX_INSTALL_PATH}/org.virtualbox.vboxwebsrv.plist"
46VBOXWEBSRV_TRG="${HOME}/Library/LaunchAgents"
47if [[ -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"
51fi
52
53#
54# Install any custom files
55#
56DATAPATH="`/usr/bin/dirname "${0}"`/../../../../../.."
57if [ -d "${DATAPATH}/.custom" ]; then
58 echo 1>&2 "Copy ${DATAPATH}/.custom to ${VBOX_INSTALL_PATH}...";
59 ${CPDIR} "${DATAPATH}/.custom/" "${VBOX_INSTALL_PATH}/custom"
60fi
61
62#
63# Register our file extensions
64#
65LSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
66if [[ -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
70fi
71
72# Check environment.
73if [ "${INSTALLER_TEMP}x" == "x" ]; then
74 echo "Required environment variable INSTALLER_TEMP is missing. Aborting installation."
75 exit 1;
76fi
77
78# Restore previously installed Extension Packs (if any)
79if [ -d "${INSTALLER_TEMP}/ExtensionPacks" ]; then
80 cp -r "${INSTALLER_TEMP}/ExtensionPacks" "${VBOX_INSTALL_PATH}"
81 rm -rf "${INSTALLER_TEMP}/ExtensionPacks"
82fi
83
84#
85# Correct the ownership of the directories in case there
86# was an existing installation.
87#
88chown -R root:admin /Applications/VirtualBox.app
89
90exit 0;
91
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