Index: /trunk/src/VBox/Additions/darwin/Installer/DiskImage/Uninstall.tool
===================================================================
--- /trunk/src/VBox/Additions/darwin/Installer/DiskImage/Uninstall.tool	(revision 76022)
+++ /trunk/src/VBox/Additions/darwin/Installer/DiskImage/Uninstall.tool	(revision 76023)
@@ -2,9 +2,9 @@
 # $Id$
 ## #file
-# VirtualBox Uninstaller Script.
+# VirtualBox Guest Additions uninstall script.
 #
 
 #
-# Copyright (C) 2007-2017 Oracle Corporation
+# Copyright (C) 2007-2018 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
@@ -105,4 +105,9 @@
 done
 
+# Remove our kexts from the cache.
+echo "Updating kernel cache."
+sudo -p "Please enter %u's password (refreshing kext cache):" touch "/System/Library/Extensions/"
+sudo -p "Please enter %u's password (refreshing kext cache):" kextcache -update-volume /
+
 echo "Done."
 exit 0;
Index: /trunk/src/VBox/Additions/darwin/Installer/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/darwin/Installer/Makefile.kmk	(revision 76022)
+++ /trunk/src/VBox/Additions/darwin/Installer/Makefile.kmk	(revision 76023)
@@ -72,5 +72,8 @@
 # The packing.
 #
-PACKING += $(VBOX_PATH_DIST)/VBoxDarwinAdditions.dmg
+PACKING += \
+	$(PATH_STAGE)/$(INST_ADDITIONS)VBoxGuestAdditions.pkg \
+	$(PATH_STAGE)/$(INST_ADDITIONS)osx/Uninstall.tool
+
 #OTHER_CLEAN = TODO
 
@@ -97,45 +100,19 @@
 
 #
-# The disk image.
-#
-$(VBOX_PATH_DIST)/VBoxDarwinAdditions.dmg: \
-		$(VBOX_PATH_PACK_TMP)/DiskImage/VBoxGuestAdditions.pkg \
-		$(VBOX_BRAND_DARWIN_DISKIMAGE_BG) \
-		$(VBOX_BRAND_DARWIN_DISKIMAGE_DS_STORE) \
-		$$(wildcard $(VBOX_ADD_PATH_DI_SRC)/DiskImage/*) \
-		$(VBOX_ADD_PATH_DI_SRC)/DiskImage/Uninstall.tool \
-		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
-	$(call MSG_TOOL,hdiutil,,,$@)
-	@# Cleanup any previously failed attempts and various trash.
-	sudo rm -Rf $(VBOX_PATH_PACK_TMP)/DiskImage.tmp
-	$(MKDIR) -p $(VBOX_PATH_PACK_TMP)/DiskImage.tmp/
-	sudo mv $(VBOX_PATH_PACK_TMP)/DiskImage/VBoxGuestAdditions.pkg $(VBOX_PATH_PACK_TMP)/DiskImage.tmp/
-	sudo rm -Rf \
-		$@ \
-		$(VBOX_PATH_PACK_TMP)/DiskImage/
-	sudo mv $(VBOX_PATH_PACK_TMP)/DiskImage.tmp $(VBOX_PATH_PACK_TMP)/DiskImage
-	@# Remove .dmg packages from old depend builds
-	$(QUIET)$(RM) -f $(wildcard $(VBOX_PATH_DIST)/VBoxDarwinAdditions-*-r*.dmg)
-	@# Populate the image with uninstaller, readme, picture, and .VolumeIcon.icns. (TODO)
-	$(INSTALL) $(VBOX_ADD_PATH_DI_SRC)/DiskImage/Uninstall.tool  $(VBOX_PATH_PACK_TMP)/DiskImage/
-ifeq (1,1)
-	@# Pedantic mode...
-	$(INSTALL) -m 644 $(VBOX_BRAND_DARWIN_DISKIMAGE_DS_STORE)           $(VBOX_PATH_PACK_TMP)/DiskImage/.DS_Store
-	$(MKDIR) $(VBOX_PATH_PACK_TMP)/DiskImage/.background
-	$(INSTALL) -m 644 $(VBOX_BRAND_DARWIN_DISKIMAGE_BG)                 $(VBOX_PATH_PACK_TMP)/DiskImage/.background/vbox_folder.tiff
-endif
-	@# Change the owners.
-	sudo chown -R root:admin $(VBOX_PATH_PACK_TMP)/DiskImage
-	@# Create the image.
-	sudo hdiutil create -format UDBZ -volname "VirtualBox Guest Additions" -srcfolder "$(VBOX_PATH_PACK_TMP)/DiskImage" "$@"
-	@# Change (back) the owner so it can be deleted by the user.
-	sudo chown "$(shell whoami)" "$@"
-	sudo chown -R "$(shell whoami)" $(VBOX_PATH_PACK_TMP)/DiskImage
+# The packing targets.
+#
+$(PATH_STAGE)/$(INST_ADDITIONS)VBoxGuestAdditions.pkg: $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditions.pkg
+	$(MKDIR) -p "$(@D)"
+	$(INSTALL) -m 0644 -- "$<" "$@"
+
+$(PATH_STAGE)/$(INST_ADDITIONS)osx/Uninstall.tool: $(VBOX_ADD_PATH_DI_SRC)/DiskImage/Uninstall.tool
+	$(MKDIR) -p "$(@D)"
+	$(INSTALL) -m 0755 -- "$<" "$@"
+
 
 #
 # The meta-package.
 #
-
-$(VBOX_PATH_PACK_TMP)/DiskImage/VBoxGuestAdditions.pkg: \
+$(VBOX_PATH_PACK_TMP)/VBoxGuestAdditions.pkg: \
 		$(VBOX_PATH_PACK_TMP)/Packages/VBoxGuestAdditionsKEXTs.pkg \
 		$(VBOX_PATH_PACK_TMP)/Packages/VBoxGuestAdditionsToolsAndServices.pkg \
@@ -145,4 +122,5 @@
 		$(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Welcome.rtf \
 		$(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Conclusion.rtf \
+		$(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/distribution-$(KBUILD_TARGET_ARCH).dist \
 		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
 	$(call MSG_TOOL,productbuild,,,$@)
@@ -203,5 +181,5 @@
 	@# Build the package.
 	$(VBOX_PRODUCTBUILD) \
-		--distribution $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/distribution.dist \
+		--distribution $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/distribution-$(KBUILD_TARGET_ARCH).dist \
 		--package-path $(VBOX_PATH_PACK_TMP)/Packages \
 		--resources $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res \
@@ -217,5 +195,5 @@
 		$(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res
 
-VBoxDarwinAdditions.pkg:: $(VBOX_PATH_PACK_TMP)/DiskImage/VBoxDarwinAdditions.pkg
+VBoxDarwinAdditions.pkg:: $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.pkg
 
 #
Index: /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/postflight
===================================================================
--- /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/postflight	(revision 76022)
+++ /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/postflight	(revision 76023)
@@ -65,10 +65,8 @@
 kextcache -update-volume / || true
 
-#echo "Loading newly installed kernel extensions."
-#kextload "/Library/Extensions/VBoxGuest.kext"
-
 load_service "org.virtualbox.additions.vboxservice" "/Library/LaunchDaemons" "root"
 load_service "org.virtualbox.additions.vboxclient" "/Library/LaunchAgents" "${USER}"
 
+echo "Warning: If VBoxService adjusts the time backwards (because of --biossystemtimeoffset), the installer may hang."
 echo "Done."
 
Index: /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper
===================================================================
--- /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper	(revision 76022)
+++ /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper	(revision 76023)
@@ -27,9 +27,13 @@
     if [ -z "$loaded" ] ; then
         echo "Loading $item kernel extension..."
-        kextload /Library/Extensions/$item.kext
+        XNU_VERSION=`LC_ALL=C uname -r | LC_ALL=C cut -d . -f 1`
+        if [ "$XNU_VERSION" -ge "10" ]; then
+            kextutil /Library/Extensions/$item.kext
+        else
+            kextload /Library/Extensions/$item.kext
+        fi
     fi
 done
 
-"/Library/Application Support/VirtualBox Guest Additions/VBoxService" -f
+exec "/Library/Application Support/VirtualBox Guest Additions/VBoxService" -f
 
-exit $?
Index: /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist
===================================================================
--- /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist	(revision 76022)
+++ /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist	(revision 76023)
@@ -15,2 +15,3 @@
 </dict>
 </plist>
+
Index: /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Localizable.strings
===================================================================
--- /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Localizable.strings	(revision 76022)
+++ /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Localizable.strings	(revision 76023)
@@ -7,4 +7,8 @@
 'choiceVBoxToolsAndServices_msg' = 'Installs the @VBOX_PRODUCT@ Guest Additions Tools and Services to /Library/Application Support/VirtualBox Guest Additions.';
 
-'UNSUPPORTED_OS_TLE' = "Unsupported OS version detected!";
-'UNSUPPORTED_OS_MSG' = "The installer has detected an unsupported operation system. VirtualBox Guest Additions require Mac OS X 10.6 or later.";
+'UNSUPPORTED_AMD64_OS_TLE' = "Incompatible OS version detected!";
+'UNSUPPORTED_AMD64_OS_MSG' = "VirtualBox Guest Additions require Mac OS X 10.7 or later running in 64-bit mode.";
+
+'UNSUPPORTED_X86_OS_TLE' = "Incompatible OS version detected!";
+'UNSUPPORTED_X86_OS_MSG' = "The 32-bit VirtualBox Guest Additions are only for Mac OS X 10.7 and earlier running in 32-bit mode.";
+
Index: /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-amd64.dist
===================================================================
--- /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-amd64.dist	(revision 76023)
+++ /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-amd64.dist	(revision 76023)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+#
+# Copyright (C) 2008-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.
+#
+-->
+<installer-gui-script minSpecVersion="1.0">
+    <title>VirtualBox_title</title>
+    <options customize="allow" allow-external-scripts="false" rootVolumeOnly="true" hostArchitectures="i386"/>
+    <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
+    <!-- This allowes a better error message compared to allowed-os-versions: -->
+    <installation-check script="checkPrerequisites()"></installation-check>
+    <script>
+    /* js:pkmk:start */
+    function checkPrerequisites()
+    {
+        sArch = system.sysctl('hw.machine');
+        system.log("Detected hw arch:    " + sArch);
+        sVer  = system.version['ProductVersion'];
+        system.log("Detected OS version: " + sVer);
+        if (sArch == 'x86_64')
+        {
+            if (system.compareVersions(sVer, '10.7') &gt;= 0)
+            {
+                system.log("checkPrerequisites returns true");
+                return true;
+            }
+        }
+        system.log("checkPrerequisites returns false!");
+        my.result.type    = 'Fatal';
+        my.result.title   = system.localizedString('UNSUPPORTED_AMD64_OS_TLE');
+        my.result.message = system.localizedString('UNSUPPORTED_AMD64_OS_MSG');
+        return false;
+    }
+    /* js:pkmk:end */
+    </script>
+    <background file="background.tif" alignment="topleft" scaling="none"/>
+    <welcome file="Welcome.rtf" mime-type="text/rtf" uti="public.rtf"/>
+    <choices-outline>
+        <line choice="choiceVBoxToolsAndServices"></line>
+        <line choice="choiceVBoxKEXTs"></line>
+    </choices-outline>
+
+    <choice id="choiceVBoxToolsAndServices" title="choiceVBoxToolsAndServices_title" description="choiceVBoxToolsAndServices_msg" start_selected="true" start_enabled="false" start_visible="true">
+        <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services"></pkg-ref>
+    </choice>
+    <choice id="choiceVBoxKEXTs" title="choiceVBoxKEXTs_title" description="choiceVBoxKEXTs_msg" start_selected="true" start_enabled="false" start_visible="true">
+        <pkg-ref id="org.virtualbox.pkg.additions.kexts"></pkg-ref>
+    </choice>
+
+    <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsToolsAndServices.pkg</pkg-ref>
+    <pkg-ref id="org.virtualbox.pkg.additions.kexts" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsKEXTs.pkg</pkg-ref>
+
+</installer-gui-script>
Index: /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-x86.dist
===================================================================
--- /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-x86.dist	(revision 76023)
+++ /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-x86.dist	(revision 76023)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+#
+# Copyright (C) 2008-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.
+#
+-->
+<installer-gui-script minSpecVersion="1.0">
+    <title>VirtualBox_title</title>
+    <options customize="allow" allow-external-scripts="false" rootVolumeOnly="true" hostArchitectures="i386"/>
+    <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
+    <!-- This allowes a better error message compared to allowed-os-versions: -->
+    <installation-check script="checkPrerequisites()"></installation-check>
+    <script>
+    /* js:pkmk:start */
+    function checkPrerequisites()
+    {
+        sArch = system.sysctl('hw.machine');
+        system.log("Detected hw arch:    " + sArch);
+        sVer  = system.version['ProductVersion'];
+        system.log("Detected OS version: " + sVer);
+        if (sArch == 'i386')
+        {
+            if (system.compareVersions(sVer, '10.8') &lt; 0)
+            {
+                system.log("checkPrerequisites returns true");
+                return true;
+            }
+        }
+        system.log("checkPrerequisites returns false!");
+        my.result.type    = 'Fatal';
+        my.result.title   = system.localizedString('UNSUPPORTED_X86_OS_TLE');
+        my.result.message = system.localizedString('UNSUPPORTED_X86_OS_MSG');
+        return false;
+    }
+    /* js:pkmk:end */
+    </script>
+    <background file="background.tif" alignment="topleft" scaling="none"/>
+    <welcome file="Welcome.rtf" mime-type="text/rtf" uti="public.rtf"/>
+    <choices-outline>
+        <line choice="choiceVBoxToolsAndServices"></line>
+        <line choice="choiceVBoxKEXTs"></line>
+    </choices-outline>
+
+    <choice id="choiceVBoxToolsAndServices" title="choiceVBoxToolsAndServices_title" description="choiceVBoxToolsAndServices_msg" start_selected="true" start_enabled="false" start_visible="true">
+        <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services"></pkg-ref>
+    </choice>
+    <choice id="choiceVBoxKEXTs" title="choiceVBoxKEXTs_title" description="choiceVBoxKEXTs_msg" start_selected="true" start_enabled="false" start_visible="true">
+        <pkg-ref id="org.virtualbox.pkg.additions.kexts"></pkg-ref>
+    </choice>
+
+    <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsToolsAndServices.pkg</pkg-ref>
+    <pkg-ref id="org.virtualbox.pkg.additions.kexts" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsKEXTs.pkg</pkg-ref>
+
+</installer-gui-script>
Index: unk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution.dist
===================================================================
--- /trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution.dist	(revision 76022)
+++ 	(revision )
@@ -1,61 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-#
-# Copyright (C) 2008-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.
-#
--->
-<installer-gui-script minSpecVersion="1.0">
-    <title>VirtualBox_title</title>
-    <options customize="allow" allow-external-scripts="yes" rootVolumeOnly="true" hostArchitectures="i386"/>
-    <installation-check script="checkPrerequisite()"></installation-check>
-    <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
-    <script>
-    /* js:pkmk:start */
-    function checkPrerequisite()
-    {
-       try
-       {
-           test = system.version['ProductVersion'];
-           system.log("OS version detected: " + test);
-           result = (system.compareVersions(test, '10.6') >= 0);
-       } catch (e) { system.log(e); result = false; }
-
-       if (!result)
-       {
-           my.result.type = 'Fatal';
-           my.result.title = system.localizedString('UNSUPPORTED_OS_TLE');
-           my.result.message = system.localizedString('UNSUPPORTED_OS_MSG');
-           return result;
-       }
-
-       system.log("result:" + result);
-       return result;
-    }
-    /* js:pkmk:end */
-    </script>
-    <background file="background.tif" alignment="topleft" scaling="none"/>
-    <welcome file="Welcome.rtf" mime-type="text/rtf" uti="public.rtf"/>
-    <choices-outline>
-        <line choice="choiceVBoxToolsAndServices"></line>
-        <line choice="choiceVBoxKEXTs"></line>
-    </choices-outline>
-
-    <choice id="choiceVBoxToolsAndServices" title="choiceVBoxToolsAndServices_title" description="choiceVBoxToolsAndServices_msg" start_selected="true" start_enabled="false" start_visible="true">
-        <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services"></pkg-ref>
-    </choice>
-    <choice id="choiceVBoxKEXTs"   title="choiceVBoxKEXTs_title"   description="choiceVBoxKEXTs_msg"   start_selected="true" start_enabled="false" start_visible="true">
-        <pkg-ref id="org.virtualbox.pkg.additions.kexts"></pkg-ref>
-    </choice>
-
-    <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsToolsAndServices.pkg</pkg-ref>
-    <pkg-ref id="org.virtualbox.pkg.additions.kexts" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsKEXTs.pkg</pkg-ref>
-
-</installer-gui-script>
