Index: /trunk/src/VBox/Additions/solaris/Installer/makepackage.sh
===================================================================
--- /trunk/src/VBox/Additions/solaris/Installer/makepackage.sh	(revision 8120)
+++ /trunk/src/VBox/Additions/solaris/Installer/makepackage.sh	(revision 8121)
@@ -1,3 +1,4 @@
 #!/bin/sh
+set -e
 # innotek VirtualBox
 # VirtualBox Solaris Guest Additions package creation script.
@@ -18,32 +19,57 @@
 #       makespackage.sh $(PATH_TARGET)/install packagename
 
-if [ -z "$2" ]; then
+if test -z "$2"; then
     echo "Usage: $0 installdir packagename"
     exit 1
 fi
 
+MY_PKGNAME=SUNWvboxguest
+MY_GREP=/usr/sfw/bin/ggrep
+MY_AWK=/usr/bin/awk
+
+# check for GNU grep we use which might not ship with all Solaris
+if test ! -f "$MY_GREP" || test ! -h "$MY_GREP"; then
+    echo "## GNU grep not found in $MY_GREP."
+    exit 1
+fi
+
+# prepare file list.
 cd "$1"
 echo 'i pkginfo=./vboxguest.pkginfo' > prototype
 echo 'i postinstall=./postinstall.sh' >> prototype
 echo 'i preremove=./preremove.sh' >> prototype
+echo 'i space=./vboxguest.space' >> prototype
 echo 'e sed /etc/devlink.tab ? ? ?' >> prototype
-find . -print | /usr/sfw/bin/ggrep -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh' | pkgproto >> prototype
+find . -print | /usr/sfw/bin/ggrep -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space' | pkgproto >> prototype
 
-/usr/bin/awk 'NF == 6 && $2 == "none" { $5 = "root"; $6 = "bin" } { print }' prototype > prototype2
-/usr/bin/awk 'NF == 6 && $2 == "none" { $3 = "opt/VirtualBoxAdditions/"$3"="$3 } { print }' prototype2 > prototype
+# don't grok for the sed class files
+$MY_AWK 'NF == 6 && $2 == "none" { $5 = "root"; $6 = "bin" } { print }' prototype > prototype2
+$MY_AWK 'NF == 6 && $2 == "none" { $3 = "opt/VirtualBoxAdditions/"$3"="$3 } { print }' prototype2 > prototype
 
 # install the kernel module to the right place (for now only 32-bit guests)
-/usr/bin/awk 'NF == 6 && $3 == "opt/VirtualBoxAdditions/vboxguest=vboxguest" { $3 = "platform/i86pc/kernel/drv/vboxguest=vboxguest" } { print }' prototype > prototype2
-/usr/bin/awk 'NF == 6 && $3 == "opt/VirtualBoxAdditions/vboxguest.conf=vboxguest.conf" { $3 = "platform/i86pc/kernel/drv/vboxguest.conf=vboxguest.conf" } { print }' prototype2 > prototype
+$MY_AWK 'NF == 6 && $3 == "opt/VirtualBoxAdditions/vboxguest=vboxguest" { $3 = "platform/i86pc/kernel/drv/vboxguest=vboxguest" } { print }' prototype > prototype2
+$MY_AWK 'NF == 6 && $3 == "opt/VirtualBoxAdditions/vboxguest.conf=vboxguest.conf" { $3 = "platform/i86pc/kernel/drv/vboxguest.conf=vboxguest.conf" } { print }' prototype2 > prototype
 
-# install the vboxclient daemon
-#/usr/bin/awk 'NF == 6 && $3 == "opt/VirtualBoxAdditions/1099.vboxclient=1099.vboxclient" { $3 = "usr/dt/config/Xsession.d/1099.vboxclient=1099.vboxclient" } { print }' prototype > prototype2
-
-#install the timesync daemon
-/usr/bin/awk 'NF == 6 && $3 == "opt/VirtualBoxAdditions/vboxservice.xml=vboxservice.xml" { $3 = "/var/svc/manifest/system/virtualbox/vboxservice.xml=vboxservice.xml" } { print }' prototype2 > prototype
+# install the timesync SMF service
+$MY_AWK 'NF == 6 && $3 == "opt/VirtualBoxAdditions/vboxservice.xml=vboxservice.xml" { $3 = "/var/svc/manifest/system/virtualbox/vboxservice.xml=vboxservice.xml" } { print }' prototype2 > prototype
 
 rm prototype2
-pkgmk -o -r .
-pkgtrans -s -o /var/spool/pkg `pwd`/$2 SUNWvboxguest
-rm -rf /var/spool/pkg/SUNWvboxguest
 
+# explicitly set timestamp to shutup warning
+VBOXPKG_TIMESTAMP=vbox`date '+%Y%m%d%H%M%S'`
+
+# create the package instance
+pkgmk -p $VBOXPKG_TIMESTAMP -o -r .
+if test $? -ne 0; then
+    exit 1
+fi
+
+# translate into package datastream (errors are sent to stderr)
+pkgtrans -s -o /var/spool/pkg `pwd`/$2 "$MY_PKGNAME"
+if test $? -ne 0; then
+    exit 1
+fi
+
+rm -rf "/var/spool/pkg/$MY_PKGNAME"
+exit $?
+
Index: /trunk/src/VBox/Additions/solaris/Installer/postinstall.sh
===================================================================
--- /trunk/src/VBox/Additions/solaris/Installer/postinstall.sh	(revision 8120)
+++ /trunk/src/VBox/Additions/solaris/Installer/postinstall.sh	(revision 8121)
@@ -64,5 +64,5 @@
     echo "*** Unknown version of the X Window System installed."
     echo "*** Failed to install the VirtualBox X Window System drivers."
-    
+
     # Exit as partially failed installation
     retval=2
Index: /trunk/src/VBox/Additions/solaris/Installer/vboxguest.space
===================================================================
--- /trunk/src/VBox/Additions/solaris/Installer/vboxguest.space	(revision 8121)
+++ /trunk/src/VBox/Additions/solaris/Installer/vboxguest.space	(revision 8121)
@@ -0,0 +1,5 @@
+# Space file for VirtualBox Guest Additions installer
+# We only create a few links and copy a few files, reserve some space
+# pathname blocks inodes
+/ 5000 8
+
Index: /trunk/src/VBox/Additions/solaris/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/solaris/Makefile.kmk	(revision 8120)
+++ /trunk/src/VBox/Additions/solaris/Makefile.kmk	(revision 8121)
@@ -22,4 +22,8 @@
 ifneq ($(BUILD_PLATFORM),solaris)
 $(error "The Solaris guest additions installer can only be built on Solaris!")
+endif
+
+ifeq ($(BUILD_PLATFORM),solaris)
+ include $(PATH_SUB_CURRENT)/SharedFolders/Makefile.kmk
 endif
 
@@ -84,4 +88,5 @@
 	$(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_SOLARIS_ADDITION_INSTALLER)/vboxguest.sh                     $(SOLARISINSTDIR)/vboxguest.sh
 	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOLARIS_ADDITION_INSTALLER)/vboxservice.xml                  $(SOLARISINSTDIR)/vboxservice.xml
+	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOLARIS_ADDITION_INSTALLER)/vboxguest.space                  $(SOLARISINSTDIR)/vboxguest.space
 	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_X11_ADDITION_INSTALLER)/vboxclient.desktop                   $(SOLARISINSTDIR)/vboxclient.desktop
 	$(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_X11_ADDITION_INSTALLER)/98vboxadd-xclient                    $(SOLARISINSTDIR)/1099.vboxclient
@@ -104,5 +109,5 @@
 	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOLARIS_ADDITION_INSTALLER)/vboxdevlink.sed                  $(SOLARISINSTDIR)/etc/devlink.tab
 	$(call MSG_L1,Creating install package: $@)
-	$(QUIET)$(SOLARISINSTDIR)/makepackage.sh $(SOLARISINSTDIR) $(PKGFILENAME) 1>/dev/null 2>/dev/null
+	$(QUIET)$(SOLARISINSTDIR)/makepackage.sh $(SOLARISINSTDIR) $(PKGFILENAME)
 	$(QUIET)$(INSTALL) -m 0644 $(SOLARISINSTDIR)/$(PKGFILENAME) $(PATH_BIN)/additions/$(PKGFILENAME)
 
