Index: trunk/src/VBox/Installer/darwin/DiskImage/VirtualBox_Uninstall.tool
===================================================================
--- trunk/src/VBox/Installer/darwin/DiskImage/VirtualBox_Uninstall.tool	(revision 31672)
+++ trunk/src/VBox/Installer/darwin/DiskImage/VirtualBox_Uninstall.tool	(revision 31672)
@@ -0,0 +1,196 @@
+#!/bin/sh
+#
+# VirtualBox Uninstaller Script.
+#
+# Copyright (C) 2007-2010 Oracle Corporation
+#
+# Use only with permission.
+#
+
+# Override any funny stuff from the user.
+export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
+
+#
+# Display a simple welcome message first.
+#
+echo ""
+echo "Welcome to the VirtualBox uninstaller script."
+echo ""
+
+#
+# Check for arguments and display
+#
+my_default_prompt=0
+if test "$#" != "0"; then
+    if test "$#" != "1" -o "$1" != "--unattended"; then
+        echo "Error: Unknown argument(s): $*"
+        echo ""
+        echo "Usage: uninstall.sh [--unattended]"
+        echo ""
+        echo "If the '--unattended' option is not given, you will be prompted"
+        echo "for a Yes/No before doing the actual uninstallation."
+        echo ""
+        exit 4;
+    fi
+    my_default_prompt="Yes"
+fi
+
+#
+# Collect directories and files to remove.
+# Note: Do NOT attempt adding directories or filenames with spaces!
+#
+my_directories=""
+my_files=""
+
+test -d /Library/StartupItems/VirtualBox/          && my_directories="$my_directories /Library/StartupItems/VirtualBox/"
+test -d /Library/Receipts/VBoxStartupItems.pkg/    && my_directories="$my_directories /Library/Receipts/VBoxStartupItems.pkg/"
+
+test -d /Library/Extensions/VBoxDrv.kext/          && my_directories="$my_directories /Library/Extensions/VBoxDrv.kext/"
+test -d /Library/Extensions/VBoxUSB.kext/          && my_directories="$my_directories /Library/Extensions/VBoxUSB.kext/"
+test -d /Library/Extensions/VBoxNetFlt.kext/       && my_directories="$my_directories /Library/Extensions/VBoxNetFlt.kext/"
+test -d /Library/Extensions/VBoxNetAdp.kext/       && my_directories="$my_directories /Library/Extensions/VBoxNetAdp.kext/"
+# Tiger support is obsolete, but we leave it here for a clean removing of older
+# VirtualBox versions
+test -d /Library/Extensions/VBoxDrvTiger.kext/     && my_directories="$my_directories /Library/Extensions/VBoxDrvTiger.kext/" 
+test -d /Library/Extensions/VBoxUSBTiger.kext/     && my_directories="$my_directories /Library/Extensions/VBoxUSBTiger.kext/"
+test -d /Library/Receipts/VBoxKEXTs.pkg/           && my_directories="$my_directories /Library/Receipts/VBoxKEXTs.pkg/"
+
+test -f /usr/bin/VirtualBox                        && my_files="$my_files /usr/bin/VirtualBox"
+test -f /usr/bin/VBoxManage                        && my_files="$my_files /usr/bin/VBoxManage"
+test -f /usr/bin/VBoxVRDP                          && my_files="$my_files /usr/bin/VBoxVRDP"
+test -f /usr/bin/VBoxHeadless                      && my_files="$my_files /usr/bin/VBoxHeadless"
+test -f /usr/bin/vboxwebsrv                        && my_files="$my_files /usr/bin/vboxwebsrv"
+test -d /Library/Receipts/VirtualBoxCLI.pkg/       && my_directories="$my_directories /Library/Receipts/VirtualBoxCLI.pkg/"
+
+test -d /Applications/VirtualBox.app/              && my_directories="$my_directories /Applications/VirtualBox.app/"
+test -d /Library/Receipts/VirtualBox.pkg/          && my_directories="$my_directories /Library/Receipts/VirtualBox.pkg/"
+
+# legacy
+test -d /Library/Receipts/VBoxDrv.pkg/             && my_directories="$my_directories /Library/Receipts/VBoxDrv.pkg/"
+test -d /Library/Receipts/VBoxUSB.pkg/             && my_directories="$my_directories /Library/Receipts/VBoxUSB.pkg/"
+
+# python stuff
+python_versions="2.3 2.5 2.6"
+for p in $python_versions; do
+    test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py  && my_files="$my_files /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py"
+    test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc && my_files="$my_files /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc"
+    test -f /Library/Python/$p/site-packages/vboxapi/__init__.py              && my_files="$my_files /Library/Python/$p/site-packages/vboxapi/__init__.py"
+    test -f /Library/Python/$p/site-packages/vboxapi/__init__.pyc             && my_files="$my_files /Library/Python/$p/site-packages/vboxapi/__init__.pyc"
+    test -f /Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info        && my_files="$my_files /Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info"
+    test -d /Library/Python/$p/site-packages/vboxapi/                         && my_directories="$my_directories /Library/Python/$p/site-packages/vboxapi/"
+done
+
+#
+# Collect KEXTs to remove.
+# Note that the unload order is significant.
+#
+my_kexts=""
+for kext in org.virtualbox.kext.VBoxUSB org.virtualbox.kext.VBoxNetFlt org.virtualbox.kext.VBoxNetAdp org.virtualbox.kext.VBoxDrv; do
+    if /usr/sbin/kextstat -b $kext -l | grep -q $kext; then
+        my_kexts="$my_kexts $kext"
+    fi
+done
+
+#
+# Did we find anything to uninstall?
+#
+if test -z "$my_directories"  -a  -z "$my_files"   -a  -z "$my_kexts"; then
+    echo "No VirtualBox files, directories or KEXTs to uninstall."
+    echo "Done."
+    exit 0;
+fi
+
+#
+# Look for running VirtualBox processes and warn the user
+# if something is running. Since deleting the files of
+# running processes isn't fatal as such, we will leave it
+# to the user to choose whether to continue or not.
+#
+# Note! comm isn't supported on Tiger, so we make -c to do the stripping.
+#
+my_processes="`ps -axco 'pid uid command' | grep -wEe '(VirtualBox|VirtualBoxVM|VBoxManage|VBoxHeadless|vboxwebsrv|VBoxXPCOMIPCD|VBoxSVC|VBoxNetDHCP)' | grep -vw grep | grep -vw VirtualBox_Uninstall.tool | tr '\n' '\a'`";
+if test -n "$my_processes"; then
+    echo 'Warning! Found the following active VirtualBox processes:'
+    echo "$my_processes" | tr '\a' '\n'
+    echo ""
+    echo "We recommend that you quit all VirtualBox processes before"
+    echo "uninstalling the product."
+    echo ""
+    if test "$my_default_prompt" != "Yes"; then
+        echo "Do you wish to continue none the less (Yes/No)?"
+        read my_answer
+        if test "$my_answer" != "Yes"  -a  "$my_answer" != "YES"  -a  "$my_answer" != "yes"; then
+            echo "Aborting uninstall. (answer: '$my_answer')".
+            exit 2;
+        fi
+        echo ""
+        my_answer=""
+    fi
+fi
+
+#
+# Display the files and directories that will be removed
+# and get the user's consent before continuing.
+#
+if test -n "$my_files"  -o  -n "$my_directories"; then
+    echo "The following files and directories (bundles) will be removed:"
+    for file in $my_files;       do echo "    $file"; done
+    for dir  in $my_directories; do echo "    $dir"; done
+fi
+if test -n "$my_kexts"; then
+echo "And the following KEXTs will be unloaded:"
+    for kext in $my_kexts;       do echo "    $kext"; done
+fi
+echo ""
+
+if test "$my_default_prompt" != "Yes"; then
+    echo "Do you wish to uninstall VirtualBox (Yes/No)?"
+    read my_answer
+    if test "$my_answer" != "Yes"  -a  "$my_answer" != "YES"  -a  "$my_answer" != "yes"; then
+        echo "Aborting uninstall. (answer: '$my_answer')".
+        exit 2;
+    fi
+    echo ""
+fi
+
+#
+# Display the sudo usage instructions and execute the command.
+#
+echo "The uninstallation processes requires administrative privileges"
+echo "because some of the installed files cannot be removed by a normal"
+echo "user. You may be prompted for your password now..."
+echo ""
+
+if test -n "$my_files"  -o  -n "$my_directories"; then
+    /usr/bin/sudo -p "Please enter %u's password:" /bin/rm -Rf $my_files $my_directories
+    my_rc=$?
+    if test "$my_rc" -ne 0; then
+        echo "An error occured durning 'sudo rm', there should be a message above. (rc=$my_rc)"
+        test -x /usr/bin/sudo || echo "warning: Cannot find /usr/bin/sudo or it's not an executable."
+        test -x /bin/rm       || echo "warning: Cannot find /bin/rm or it's not an executable"
+        echo ""
+        echo "The uninstall failed. Please retry."
+        exit 1;
+    fi
+fi
+
+my_rc=0
+for kext in $my_kexts; do
+    echo unloading $kext
+    /usr/bin/sudo -p "Please enter %u's password (unloading $kext):" /sbin/kextunload -m $kext
+    my_rc2=$?
+    if test "$my_rc2" -ne 0; then
+        echo "An error occured durning 'sudo /sbin/kextunload -m $kext', there should be a message above. (rc=$my_rc2)"
+        test -x /usr/bin/sudo    || echo "warning: Cannot find /usr/bin/sudo or it's not an executable."
+        test -x /sbin/kextunload || echo "warning: Cannot find /sbin/kextunload or it's not an executable"
+        my_rc=$my_rc2
+    fi
+done
+if test "$my_rc" -eq 0; then
+    echo "Successfully uninstalled VirtualBox."
+else
+    echo "Failed to unload on or more KEXTs, please reboot the machine to complete the uninstall."
+fi
+echo "Done."
+exit 0;
+
Index: trunk/src/VBox/Installer/darwin/Makefile.kmk
===================================================================
--- trunk/src/VBox/Installer/darwin/Makefile.kmk	(revision 31667)
+++ trunk/src/VBox/Installer/darwin/Makefile.kmk	(revision 31672)
@@ -5,5 +5,5 @@
 
 #
-# Copyright (C) 2006-2009 Oracle Corporation
+# Copyright (C) 2006-2010 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
@@ -22,5 +22,7 @@
 # Include sub-makefiles.
 #
-include $(PATH_SUB_CURRENT)/InstallerPlugins/Makefile.kmk
+ifndef VBOX_OSE
+ include $(PATH_SUB_CURRENT)/InstallerPlugins/Makefile.kmk
+endif
 
 
@@ -80,5 +82,4 @@
 AWK=/usr/bin/awk
 HDIUTIL=/usr/bin/hdiutil
-
 
 #
@@ -190,8 +191,9 @@
 		$(VBOX_PATH_PACK_TMP)/Packages/VirtualBox.pkg \
 		$$(TARGET_RegistrationPane) \
-		$(VBOX_PATH_DI_SRC)/InstallerPlugins/RegistrationPane/Info.plist \
-		$$(wildcard $(VBOX_PATH_DI_SRC)/InstallerPlugins/RegistrationPane/Resources/*.lproj/*.strings \
-		            $(VBOX_PATH_DI_SRC)/InstallerPlugins/RegistrationPane/Resources/*.lproj/RegistrationPane.nib/*.nib) \
-		$$(wildcard $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/* \
+		$(if $(VBOX_OSE), , \
+    		$(VBOX_PATH_DI_SRC)/InstallerPlugins/RegistrationPane/Info.plist \
+	    	$$(wildcard $(VBOX_PATH_DI_SRC)/InstallerPlugins/RegistrationPane/Resources/*.lproj/*.strings \
+		                $(VBOX_PATH_DI_SRC)/InstallerPlugins/RegistrationPane/Resources/*.lproj/RegistrationPane.nib/*.nib)) \
+	    $$(wildcard $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/* \
 		            $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/*.lproj/*) \
 		$(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), \
@@ -285,4 +287,5 @@
 	@# Copy the plugins.
 	$(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/distribution.dist                $@/Contents/
+ifndef VBOX_OSE
 	$(MKDIR) -p $@/Contents/Plugins/
 ifdef VBOX_WITH_SERIALNUMBER_INSTALL
@@ -307,4 +310,5 @@
 		$(INSTALL) -m 0644 $(VBOX_BRAND_$(f)_REGISTRATIONPANE_LOCALIZABLE_STRINGS)                $@/Contents/Plugins/RegistrationPane.bundle/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Localizable.strings$(NLTAB) \
 	)
+endif
 	@# Cleanup.
 	sudo rm -Rf \
@@ -318,5 +322,8 @@
 # The VirtualBox Kernel extensions.
 #
-VBOX_DI_KEXTS_UNIVERSAL = VBoxDrv VBoxUSB VBoxNetFlt VBoxNetAdp
+VBOX_DI_KEXTS_UNIVERSAL = VBoxDrv VBoxNetFlt VBoxNetAdp
+ifndef VBOX_OSE
+ VBOX_DI_KEXTS_UNIVERSAL += VBoxUSB
+endif
 VBOX_DI_KEXTS = $(VBOX_DI_KEXTS_UNIVERSAL)
 
@@ -608,5 +615,5 @@
 ifdef VBOX_WITH_PYTHON
  VBOX_DI_VBAPP_DYLIBS.x86 += \
- 	MacOS/VBoxPython2_5.so \
+ 	$(if-expr defined(VBOX_WITH_MAC_OS_X_10_5_SUPPORT),MacOS/VBoxPython2_5.so,) \
 	$(if-expr defined(VBOX_WITH_MAC_OS_X_10_4_SUPPORT),MacOS/VBoxPython2_3.so,)
 endif
@@ -1065,339 +1072,5 @@
 		$(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.res
 
-#
-# The OpenSolaris VM bundle distribution package.
-#
-$(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg: \
-		$(VBOX_PATH_PACK_TMP)/PackagesBundle/SolarisVM.pkg \
-		$$(wildcard $(VBOX_PATH_DI_SRC)/VirtualBoxBundle_mpkg/* \
-		            $(VBOX_PATH_DI_SRC)/VirtualBoxBundle_mpkg/*.lproj/*) \
-		$$(TARGET_RegistrationPane) \
-		$(VBOX_PATH_DI_SRC)/InstallerPlugins/RegistrationPane/Info.plist \
-		$$(wildcard $(VBOX_PATH_DI_SRC)/InstallerPlugins/RegistrationPane/Resources/*.lproj/*.strings \
-		            $(VBOX_PATH_DI_SRC)/InstallerPlugins/RegistrationPane/Resources/*.lproj/RegistrationPane.nib/*.nib) \
-		$(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), \
-			$(VBOX_BRAND_$(f)_VIRTUALBOXBUNDLE_DESCRIPTION_PLIST) \
-			$(VBOX_BRAND_$(f)_VIRTUALBOXBUNDLE_LOCALIZABLE_STRINGS)) \
-		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
-	sudo rm -Rf \
-		$@ \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.desc \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.res
-	@# Correct directory permissions are important.
-	$(MKDIR) -p \
-		$(@D) \
-		$@/Contents \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.desc \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.res
-	@# Do keyword replacement in the package info and description files.
-	$(SED) \
-		-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-		-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-		-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-		-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
-		-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
-		-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
-		-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
-		--output $(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.desc/Info.plist \
-		$(VBOX_PATH_DI_SRC)/VirtualBoxBundle_mpkg/Info.plist
-	$(SED) \
-		-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-		-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-		-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-		-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
-		-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
-		-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
-		-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
-		--output $(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.desc/Description.plist \
-		$(VBOX_PATH_DI_SRC)/VirtualBoxBundle_mpkg/Description.plist
-	$(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/VirtualBoxBundle_mpkg/check_files              $(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.res/
-	$(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/VirtualBoxBundle_mpkg/vboxtest                 $(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.res/
-	@# Build the package.
-	$(VBOX_PACKAGEMAKER) -build -v \
-		-p $@ \
-		-r $(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.res \
-		-i $(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.desc/Info.plist \
-		-d $(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.desc/Description.plist \
-		-mi $(VBOX_PATH_PACK_TMP)/PackagesBundle
-	@# Create a distribution file.
-	$(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBoxBundle_mpkg/distribution.dist        $@/Contents/
-	$(SED) \
-		-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
-		-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
-		-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
-		--output $@/Contents/Resources/English.lproj/Localizable.strings \
-		$(VBOX_PATH_DI_SRC)/VirtualBoxBundle_mpkg/Localizable.strings
-	@# Make a link to the plugin directory of the VirtualBox.mpkg
-	$(LN) -s ../../VirtualBox.mpkg/Contents/Plugins                                       $@/Contents/Plugins
-	@# Make links to the other resources, so they are up to date & don't waste space on the dvd.
-	$(LN) -s ../../../VirtualBox.mpkg/Contents/Resources/checkforrunningvms               $@/Contents/Resources/checkforrunningvms
-	$(LN) -s ../../../../VirtualBox.mpkg/Contents/Resources/English.lproj/Welcome.html    $@/Contents/Resources/English.lproj/Welcome.html
-	$(LN) -s ../../../../VirtualBox.mpkg/Contents/Resources/English.lproj/Conclusion.html $@/Contents/Resources/English.lproj/Conclusion.html
-	$(LN) -s ../../../../VirtualBox.mpkg/Contents/Resources/English.lproj/License.rtf     $@/Contents/Resources/English.lproj/License.rtf
-	$(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), \
-		$(MKDIR) -p \
-			$@/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj$(NLTAB) \
-		$(SED) \
-			-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-			-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-			-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-			-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
-			-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
-			-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
-			-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
-			--output $@/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Description.plist \
-			$(VBOX_BRAND_$(f)_VIRTUALBOXBUNDLE_DESCRIPTION_PLIST)$(NLTAB) \
-		$(SED) \
-			-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
-			-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
-			-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
-			--output $@/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Localizable.strings \
-			$(VBOX_BRAND_$(f)_VIRTUALBOXBUNDLE_LOCALIZABLE_STRINGS)$(NLTAB) \
-		$(LN) -s ../../../../VirtualBox.mpkg/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Welcome.html     $@/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Welcome.html$(NLTAB) \
-		$(LN) -s ../../../../VirtualBox.mpkg/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Conclusion.html  $@/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Conclusion.html$(NLTAB) \
-		$(LN) -s ../../../../VirtualBox.mpkg/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/License.rtf      $@/Contents/Resources/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/License.rtf$(NLTAB) \
-	)
-	$(LN) -s ../../../VirtualBox.mpkg/Contents/Resources/background.tif $@/Contents/Resources/background.tif
-	@# Cleanup.
-	sudo rm -Rf \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.desc \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg.res
-
-
-$(VBOX_PATH_DIST)/VBoxMacBundleInstaller-$(KBUILD_TARGET_ARCH).zip: \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxBundle.mpkg \
-		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
-	$(RM) -Rf $@
-	$(REDIRECT) -C $(VBOX_PATH_PACK_TMP) -- $(ZIP) -9ry $@ VirtualBoxBundle.mpkg/
-
-#
-# The OpenSolaris VM
-#
-$(VBOX_PATH_PACK_TMP)/PackagesBundle/SolarisVM.pkg: \
-		$$(wildcard $(VBOX_PATH_DI_SRC)/SolarisVM/* \
-		            $(VBOX_PATH_DI_SRC)/SolarisVM/*.lproj/*) \
-		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
-	$(call MSG_TOOL,PackageMaker,,,$@)
-	@# Cleanup any previously failed attempts.
-	sudo rm -Rf \
-		$@ \
-		$(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.root \
-		$(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.desc \
-		$(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.res
-	@# Correct directory permissions are important.
-	$(MKDIR) -p \
-		$(@D) \
-		$(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.root \
-		$(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.desc \
-		$(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.res
-	@# Do keyword replacement in the package info and description files.
-	$(SED) \
-		-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-		-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-		-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-		-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
-		-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
-		-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
-		-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
-		--output $(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.desc/Info.plist \
-		$(VBOX_PATH_DI_SRC)/SolarisVM/Info.plist
-	$(SED) \
-		-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-		-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-		-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-		-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
-		-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
-		-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
-		-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
-		--output $(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.desc/Description.plist \
-		$(VBOX_PATH_DI_SRC)/SolarisVM/Description.plist
-	@# Copy the resources.
-	$(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/SolarisVM/postflight     $(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.res/
-	$(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/SolarisVM/pget           $(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.res/
-	$(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/SolarisVM/config         $(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.res/
-	@# Build the package.
-	$(VBOX_PACKAGEMAKER) -build -v \
-		-p $@ \
-		-f $(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.root \
-		-r $(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.res \
-		-i $(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.desc/Info.plist \
-		-d $(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.desc/Description.plist
-	@# Cleanup
-	sudo rm -Rf \
-		$(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.root \
-		$(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.desc \
-		$(VBOX_PATH_PACK_TMP)/SolarisVM.pkg.res
-
-#
-# The VirtualBox bundle iso file
-#
-# The iso file should contain all platform installers (Win, Mac, Linux,
-# Solaris). Additionally it adds an example VM (OpenSolaris) which currently is
-# automatically installed and configured on Windows & Mac OS X. In the following
-# make step no one of the necessary files will be created. All is fetch
-# external and build in the release step. This makes sure that the version info
-# is fixed for the current release. This is also true for the Win & Mac bundle
-# installers. The following variables define the locations of the various
-# needed files.
-## @todo Maybe we can automatically download the VBoxAll package.
-#
-VBOX_TMP_DIR ?= /VBox
-VBOX_ALL ?= $(VBOX_TMP_DIR)/VirtualBox-all*.tar.bz2
-
-# Calculate the vdi size in KBytes
-# zip version
-#VBOX_EXAMPLE_VDI_SIZE ?= $(int-div $(shell $(UNZIP) -l $(VBOX_BRAND_EXAMPLE_VDI) "*.vdi" | $(AWK) '/vdi/{print $$1}'), 1024)
-# tar.gz version
-#VBOX_EXAMPLE_VDI_SIZE ?= $(int-div $(shell $(GZIP) -dc $(VBOX_BRAND_EXAMPLE_VDI) | $(TAR) -tvf - | $(AWK) '/vdi/{print $$3}'), 1024)
-# gz version
-# Buggy gzip. If the original file size is greater than 4GB they is reported
-# wrong with the -l switch. So manually add the missing 4GB. See
-# http://www.mail-archive.com/bug-gzip@gnu.org/msg00168.html for the bugreport.
-VBOX_EXAMPLE_VDI_SIZE ?= $(int-div $(int-add $(shell $(GZIP) -lq $(VBOX_BRAND_EXAMPLE_VDI) | $(AWK) '/vdi/{print $$2}'), 4294967296), 1024)
-
-# Unpack the vbox all to a temp directory
-$(VBOX_PATH_PACK_TMP)/VirtualBoxAll/: \
-		$(VBOX_ALL) \
-		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
-	sudo rm -Rf \
-		$@
-	$(MKDIR) -p \
-		$@
-	$(TAR) -xjvf $(VBOX_ALL) -C $@
-
-# Create the standard iso (No bundle installer and therfor necessary files).
-$(VBOX_PATH_DIST)/VirtualBox.iso: \
-		gen_isoimage_dir_CD \
-		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
-	sudo rm -Rf \
-		$@
-	$(MKDIR) -p \
-		$(@D)
-	@# All the files are there so create the hybrid iso
-	$(HDIUTIL) makehybrid \
-		-o $@ \
-		-hfs \
-		-iso \
-		-joliet \
-		-hfs-volume-name    "VirtualBox" \
-		-iso-volume-name    "VirtualBox" \
-		-joliet-volume-name "VirtualBox" \
-		-hfs-openfolder "$(VBOX_PATH_PACK_TMP)/IsoImage" \
-		-hide-hfs    "$(VBOX_PATH_PACK_TMP)/IsoImage/{$(subst $(SP),$(COMMA),$(VBOX_BRAND_INST_HIDE_MAC))}" \
-		-hide-iso    "$(VBOX_PATH_PACK_TMP)/IsoImage/{$(subst $(SP),$(COMMA),$(VBOX_BRAND_INST_HIDE_WIN))}" \
-		-hide-joliet "$(VBOX_PATH_PACK_TMP)/IsoImage/{$(subst $(SP),$(COMMA),$(VBOX_BRAND_INST_HIDE_WIN))}" \
-		$(VBOX_PATH_PACK_TMP)/IsoImage
-	@# Generate MD5 sum
-	$(REDIRECT) -C $(@D) -- $(MD5SUM_EXT) -p -o VirtualBox.md5 VirtualBox.iso
-
-# Create the bundle iso.
-$(VBOX_PATH_DIST)/VirtualBoxBundle.iso: \
-		gen_isoimage_dir_DVD \
-		$(VBOX_BRAND_EXAMPLE_MACHINE_INI) \
-		$(VBOX_BRAND_EXAMPLE_VDI) \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxAll/VBoxWinBundleInstaller-x86.zip \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxAll/VBoxWinBundleInstaller-amd64.zip \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxAll/VBoxMacBundleInstaller-x86.zip \
-		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
-	$(eval VBOX_WIN_BUNDLE_INSTALLER_FILES.x86   ?= $(shell $(UNZIP) -qql $(VBOX_PATH_PACK_TMP)/VirtualBoxAll/VBoxWinBundleInstaller-x86.zip | $(AWK) '{print $$4}' | $(SED) 's/\/.*//g' | uniq))
-	$(eval VBOX_WIN_BUNDLE_INSTALLER_FILES.amd64 ?= $(shell $(UNZIP) -qql $(VBOX_PATH_PACK_TMP)/VirtualBoxAll/VBoxWinBundleInstaller-amd64.zip | $(AWK) '{print $$4}' | $(SED) 's/\/.*//g' | uniq))
-	sudo rm -Rf \
-		$@
-	$(MKDIR) -p \
-		$(@D)
-	@# Install the example vm stuff
-	$(INSTALL) -m 0644 $(VBOX_BRAND_EXAMPLE_MACHINE_INI) $(VBOX_PATH_PACK_TMP)/IsoImage/
-	$(INSTALL) -m 0644 $(VBOX_BRAND_EXAMPLE_VDI) $(VBOX_PATH_PACK_TMP)/IsoImage/
-	@# Copy the Win bundle installer stuff
-	$(UNZIP) $(VBOX_PATH_PACK_TMP)/VirtualBoxAll/VBoxWinBundleInstaller-x86.zip -d $(VBOX_PATH_PACK_TMP)/IsoImage/
-	$(UNZIP) $(VBOX_PATH_PACK_TMP)/VirtualBoxAll/VBoxWinBundleInstaller-amd64.zip -d $(VBOX_PATH_PACK_TMP)/IsoImage/
-	@# Copy the Mac bundle installer stuff
-	$(UNZIP) $(VBOX_PATH_PACK_TMP)/VirtualBoxAll/VBoxMacBundleInstaller-x86.zip -d $(VBOX_PATH_PACK_TMP)/IsoImage/
-	@# Write the right file size of the vdi to the bundle installer. For that
-	@# we need a tmp file cause sed doesn't do infile replacement.
-	$(SED) \
-		-e 's/\(solarisvm.*installKBytes="\).*\(" auth="None"\)/\1$(VBOX_EXAMPLE_VDI_SIZE)\2/g' \
-		--output $(VBOX_PATH_PACK_TMP)/distribution.dist.tmp \
-		$(VBOX_PATH_PACK_TMP)/IsoImage/VirtualBoxBundle.mpkg/Contents/distribution.dist
-	$(MV) $(VBOX_PATH_PACK_TMP)/distribution.dist.tmp $(VBOX_PATH_PACK_TMP)/IsoImage/VirtualBoxBundle.mpkg/Contents/distribution.dist
-	@# We need a little different DS_Store than the one in the standard installer
-	$(INSTALL) -m 644 $(VBOX_PATH_DI_SRC)/BundleIsoImage/DS_Store $(VBOX_PATH_PACK_TMP)/IsoImage/.DS_Store
-	@# All the files are there so create the hybrid iso
-	$(HDIUTIL) makehybrid \
-		-o $@ \
-		-hfs \
-		-udf \
-		-hfs-volume-name "VirtualBox" \
-		-udf-volume-name "VirtualBox" \
-		-hfs-openfolder "$(VBOX_PATH_PACK_TMP)/IsoImage" \
-		-hide-hfs "$(VBOX_PATH_PACK_TMP)/IsoImage/{$(subst $(SP),$(COMMA),$(VBOX_WIN_BUNDLE_INSTALLER_FILES.x86) $(VBOX_WIN_BUNDLE_INSTALLER_FILES.amd64) $(VBOX_BRAND_INST_HIDE_MAC))}" \
-		-hide-udf "$(VBOX_PATH_PACK_TMP)/IsoImage/{$(subst $(SP),$(COMMA),$(VBOX_BRAND_INST_HIDE_WIN))}" \
-		$(VBOX_PATH_PACK_TMP)/IsoImage
-	@# Generate MD5 sum
-	$(REDIRECT) -C $(@D) -- $(MD5SUM_EXT) -p -o VirtualBoxBundle.md5 VirtualBoxBundle.iso
-
-# We have to make sure that $(VBOX_PATH_PACK_TMP)/IsoImage/ contains only files
-# which should be there. Therewith we make it a define & delete it on every
-# recreation.
-VBOX_TMP_MOUNT ?= /tmp/IsoImage.mnt
-define def_gen_isoimage_dir
-gen_isoimage_dir_$(medium): \
-		$(VBOX_PATH_PACK_TMP)/VirtualBoxAll/ \
-		$(VBOX_BRAND_CUSTOM) \
-		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
-	sudo rm -Rf \
-		$(VBOX_PATH_PACK_TMP)/IsoImage
-	#test ! -e $(VBOX_TMP_MOUNT) || ($(HDIUTIL) detach $(VBOX_TMP_MOUNT) && sudo rmdir $(VBOX_TMP_MOUNT))
-	test ! -e $(VBOX_TMP_MOUNT) || (sudo rmdir $(VBOX_TMP_MOUNT))
-	@# Correct directory permissions are important.
-	$(MKDIR) -p \
-		$(VBOX_PATH_PACK_TMP)/IsoImage/ \
-		$(VBOX_TMP_MOUNT)
-ifdef VBOX_BRAND_CUSTOM
-	$(MKDIR) -p $(VBOX_PATH_PACK_TMP)/IsoImage/.custom
-endif
-	@# Copy all platform installer without the OS X one and the other extra files
-	$(CP_EXT) $(patsubst %,$(VBOX_PATH_PACK_TMP)/VirtualBoxAll/%,$(VBOX_BRAND_INST_$(medium)_FILES)) $(VBOX_PATH_PACK_TMP)/IsoImage/
-	@# Copy custom stuff if defined
-	$(foreach custom, $(VBOX_BRAND_CUSTOM) \
-		 ,$(INSTALL) -m 644  $(custom) $(VBOX_PATH_PACK_TMP)/IsoImage/.custom/$(NLTAB))
-	@# Copy all user manuals
-ifdef VBOX_BRAND_en_EN_MANUAL_NAME
-	$(INSTALL) -m 644 $(VBOX_PATH_PACK_TMP)/VirtualBoxAll/UserManual.pdf       $(VBOX_PATH_PACK_TMP)/IsoImage/$(VBOX_BRAND_en_EN_MANUAL_NAME).pdf
-else
-	$(INSTALL) -m 644 $(VBOX_PATH_PACK_TMP)/VirtualBoxAll/UserManual.pdf       $(VBOX_PATH_PACK_TMP)/IsoImage/User\ Manual.pdf
-endif
-ifdef VBOX_BRAND_de_DE_MANUAL_NAME
-	$(INSTALL) -m 644 $(VBOX_PATH_PACK_TMP)/VirtualBoxAll/UserManual_de_DE.pdf "$(VBOX_PATH_PACK_TMP)/IsoImage/$(VBOX_BRAND_de_DE_MANUAL_NAME).pdf"
-endif
-ifdef VBOX_BRAND_fr_FR_MANUAL_NAME
-	$(INSTALL) -m 644 $(VBOX_PATH_PACK_TMP)/VirtualBoxAll/UserManual_fr_FR.pdf "$(VBOX_PATH_PACK_TMP)/IsoImage/$(VBOX_BRAND_fr_FR_MANUAL_NAME).pdf"
-endif
-ifdef VBOX_WITH_COMBINED_PACKAGE
-	@# Rename the Windows multi platform installer (.exe) to a unique name the HTML auto start menu can handle
-	$(MV) $(firstword $(wildcard $(VBOX_PATH_PACK_TMP)/IsoImage/VirtualBox-*-Win.exe)) "$(VBOX_PATH_PACK_TMP)/IsoImage/VirtualBox-Win.exe"
-endif
-	@# Temporary mount the dmg file
-	@# Note: man hdiutil: "Note that mountpoint paths must be less than MNAMELEN
-	@# characters (90 as of this writing)." So we use a path in /tmp/.
-	$(HDIUTIL) attach -noautoopen -readonly -mountpoint $(VBOX_TMP_MOUNT) $(patsubst %,$(VBOX_PATH_PACK_TMP)/VirtualBoxAll/%,VirtualBox-*-OSX.dmg)
-	@# Copy all the necessary stuff over
-	$(INSTALL) $(VBOX_TMP_MOUNT)/VirtualBox_Uninstall.tool $(VBOX_PATH_PACK_TMP)/IsoImage/
-	$(INSTALL) $(VBOX_TMP_MOUNT)/.DS_Store $(VBOX_PATH_PACK_TMP)/IsoImage/
-	$(CP) -R $(VBOX_TMP_MOUNT)/.background $(VBOX_PATH_PACK_TMP)/IsoImage/
-	$(CP) -R $(VBOX_TMP_MOUNT)/VirtualBox.mpkg $(VBOX_PATH_PACK_TMP)/IsoImage/
-ifdef VBOX_BRAND_DARWIN_DISKIMAGE_LN_APP
-	$(LN) -s /Applications/ $(VBOX_PATH_PACK_TMP)/IsoImage/Applications
-endif
-	@# Copy specific files
-	$(VBOX_BRAND_INST_$(medium)_GEN_ISOIMAGE_DIR)
-	@# Unmount the dmg file
-	$(HDIUTIL) detach $(VBOX_TMP_MOUNT)
-	@# Cleanup
-	sudo rm -Rf \
-		$(VBOX_TMP_MOUNT)
-endef
-
-# Generate a rule for the CD & the DVD respectively.
-$(foreach medium,$(VBOX_BRAND_MEDIA),$(eval $(def_gen_isoimage_dir)))
-
+ifndef VBOX_OSE
+ include $(PATH_SUB_CURRENT)/Bundle.kmk
+endif
