summaryrefslogtreecommitdiff
path: root/src/VBox/Installer/darwin/VirtualBox
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Installer/darwin/VirtualBox')
-rw-r--r--src/VBox/Installer/darwin/VirtualBox/PkgBuildComponent.plist1
-rwxr-xr-xsrc/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh31
-rw-r--r--src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist7
-rwxr-xr-xsrc/VBox/Installer/darwin/VirtualBox/postflight27
-rwxr-xr-xsrc/VBox/Installer/darwin/VirtualBox/preflight31
5 files changed, 78 insertions, 19 deletions
diff --git a/src/VBox/Installer/darwin/VirtualBox/PkgBuildComponent.plist b/src/VBox/Installer/darwin/VirtualBox/PkgBuildComponent.plist
index a73d8102..a67ae42c 100644
--- a/src/VBox/Installer/darwin/VirtualBox/PkgBuildComponent.plist
+++ b/src/VBox/Installer/darwin/VirtualBox/PkgBuildComponent.plist
@@ -8,6 +8,7 @@
<key>BundleIsVersionChecked</key> <false/>
<key>BundleHasStrictIdentifier</key> <false/>
<key>BundleOverwriteAction</key> <string>upgrade</string>
+ <key>BundlePreInstallScriptPath</key> <string>preflight</string>
<key>BundlePostInstallScriptPath</key> <string>postflight</string>
</dict>
</array>
diff --git a/src/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh b/src/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh
index 87c23a34..16c1dfdf 100755
--- a/src/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh
+++ b/src/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh
@@ -17,7 +17,7 @@
# and starts the VMs.
#
-function vboxStartAllUserVms()
+function vboxStartStopAllUserVms()
{
# Go through the list and filter out all users without a shell and a
# non existing home.
@@ -33,14 +33,29 @@ function vboxStartAllUserVms()
continue
fi
- # Start the daemon
- su ${user} -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --start --background --config ${1}"
-
+ case "${1}" in
+ start)
+ # Start the daemon
+ su ${user} -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --start --background --config ${CONFIG}"
+ ;;
+ stop)
+ # Start the daemon
+ su ${user} -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --stop --config ${CONFIG}"
+ ;;
+ *)
+ echo "Usage: start|stop"
+ exit 1
+ esac
done
}
-case $1 in
- --start) vboxStartAllUserVms ${2};;
- *) echo "Unknown option ${1}";;
-esac
+function vboxStopAllUserVms()
+{
+ vboxStartStopAllUserVms "stop"
+}
+
+CONFIG=${1}
+vboxStartStopAllUserVms "start"
+trap vboxStopAllUserVms HUP KILL TERM
+
diff --git a/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist b/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist
index 1d97e16b..ca0b770e 100644
--- a/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist
+++ b/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist
@@ -4,15 +4,16 @@
<dict>
<key>Disabled</key>
<true/>
- <key>KeepAlive</key>
- <false/>
<key>Label</key>
<string>org.virtualbox.vboxautostart</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh</string>
- <string>--start</string>
<string>/etc/vbox/autostart.cfg</string>
</array>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>LaunchOnlyOnce</key>
+ <true/>
</dict>
</plist>
diff --git a/src/VBox/Installer/darwin/VirtualBox/postflight b/src/VBox/Installer/darwin/VirtualBox/postflight
index a7f5f9b4..57271316 100755
--- a/src/VBox/Installer/darwin/VirtualBox/postflight
+++ b/src/VBox/Installer/darwin/VirtualBox/postflight
@@ -16,12 +16,6 @@ CP="/bin/cp -f"
CPDIR="${CP} -R"
#
-# Correct the ownership of the directories in case there
-# was an existing installation.
-#
-chown -R root:admin /Applications/VirtualBox.app
-
-#
# Select the right architecture.
#
MY_ARCH=`uname -m`
@@ -39,7 +33,7 @@ do
exit 1;
fi
rm -f "$linkname"
- ln -vh "$trg" "$linkname"
+ /bin/ln -vh "$trg" "$linkname"
done
#
@@ -90,5 +84,22 @@ if [[ -e "${LSREGISTER}" && "x" != "x${USER}" ]]; then
/usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app/Contents/Resources/vmstarter.app
fi
-exit 0;
+# Check environment.
+if [ "${INSTALLER_TEMP}x" == "x" ]; then
+ echo "Required environment variable INSTALLER_TEMP is missing. Aborting installation."
+ exit 1;
+fi
+# Restore previously installed Extension Packs (if any)
+if [ -d "${INSTALLER_TEMP}/ExtensionPacks" ]; then
+ cp -r "${INSTALLER_TEMP}/ExtensionPacks" "${VBOX_INSTALL_PATH}"
+ rm -rf "${INSTALLER_TEMP}/ExtensionPacks"
+fi
+
+#
+# Correct the ownership of the directories in case there
+# was an existing installation.
+#
+chown -R root:admin /Applications/VirtualBox.app
+
+exit 0;
diff --git a/src/VBox/Installer/darwin/VirtualBox/preflight b/src/VBox/Installer/darwin/VirtualBox/preflight
new file mode 100755
index 00000000..9c264851
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox/preflight
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+#
+# Copyright (C) 2007-2013 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+set -e
+
+# Check environment.
+if [ "${INSTALLER_TEMP}x" == "x" ]; then
+ echo "Required environment variable INSTALLER_TEMP is missing. Aborting installation."
+ exit 1;
+fi
+
+# Backup previously installed Extension Packs before
+# installation process will completely remove previously installed
+# VirtualBox distribution.
+EXTPACKS_ROOT_PATH="/Applications/VirtualBox.app/Contents/MacOS/ExtensionPacks"
+if [ -d "${EXTPACKS_ROOT_PATH}" ]; then
+ cp -r "${EXTPACKS_ROOT_PATH}" "${INSTALLER_TEMP}"
+fi
+
+exit 0;