Index: trunk/src/VBox/Additions/solaris/Installer/makepackage.sh
===================================================================
--- trunk/src/VBox/Additions/solaris/Installer/makepackage.sh	(revision 25681)
+++ trunk/src/VBox/Additions/solaris/Installer/makepackage.sh	(revision 25712)
@@ -27,5 +27,6 @@
 fi
 
-VBOX_INSTALLED_DIR=$1
+VBOX_BASEPKG_DIR=$1
+VBOX_INSTALLED_DIR="$VBOX_BASEPKG_DIR"/opt/VirtualBoxAdditions
 VBOX_PKGFILENAME=$2
 VBOX_SVN_REV=$3
@@ -53,6 +54,13 @@
 }
 
+
+# Create relative hardlinks
+cd "$VBOX_INSTALLED_DIR"
+ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxService
+ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxClient
+ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxControl
+
 # prepare file list
-cd "$VBOX_INSTALLED_DIR"
+cd "$VBOX_BASEPKG_DIR"
 echo 'i pkginfo=./vboxguest.pkginfo' > prototype
 echo 'i postinstall=./postinstall.sh' >> prototype
@@ -63,49 +71,22 @@
     echo 'i copyright=./vboxguest.copyright' >> prototype
 fi
-find . -print | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype
+
+# Exclude directory entries to not cause conflicts (owner,group) with existing directories in the system
+find . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype
+
+# Include only opt/VirtualBoxAdditions and subdirectories as we want uninstall to clean up directory structure as well
+find . -type d | $VBOX_GGREP -E 'opt/VirtualBoxAdditions' | pkgproto >> prototype
 
 # don't grok for the class files
-filelist_fixup prototype '$2 == "none"'                                                     '$5 = "root"; $6 = "bin"'
-filelist_fixup prototype '$2 == "none"'                                                     '$3 = "opt/VirtualBoxAdditions/"$3"="$3'
+filelist_fixup prototype '$2 == "none"'                                                                      '$5 = "root"; $6 = "bin"'
 
 # VBoxService requires suid
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxService=VBoxService"'              '$4 = "4755"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxService=amd64/VBoxService"'  '$4 = "4755"'
+filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxService"'                                       '$4 = "4755"'
+filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxService"'                                 '$4 = "4755"'
 
-# 32-bit vboxguest
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/vboxguest=vboxguest"'              '$3 = "usr/kernel/drv/vboxguest=vboxguest"; $6="sys"'
+# vboxguest
+filelist_fixup prototype '$3 == "usr/kernel/drv/vboxguest"'                                                  '$6="sys"'
+filelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxguest"'                                            '$6="sys"'
 
-# 64-bit vboxguest
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/vboxguest=amd64/vboxguest"'  '$3 = "usr/kernel/drv/amd64/vboxguest=amd64/vboxguest"; $6="sys"'
-
-# vboxguest module config file
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/vboxguest.conf=vboxguest.conf"'    '$3 = "usr/kernel/drv/vboxguest.conf=vboxguest.conf"'
-
-# vboxfsmount binary (always 32-bit on combined package)
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/vboxfsmount=vboxfsmount"'         '$3 = "etc/fs/vboxfs/mount=vboxfsmount"; $6="sys"'
-
-# this is required for amd64-specific package where we do not build 32-bit binaries
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/vboxfsmount=amd64/vboxfsmount"'   '$3 = "etc/fs/vboxfs/mount=amd64/vboxfsmount"; $6="sys"'
-
-# crogl 32-bit opengl fixup
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxOGL.so=VBoxOGL.so"'                             '$3 = "usr/lib/VBoxOGL.so=VBoxOGL.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxOGLcrutil.so=VBoxOGLcrutil.so"'                 '$3 = "usr/lib/VBoxOGLcrutil.so=VBoxOGLcrutil.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxOGLfeedbackspu.so=VBoxOGLfeedbackspu.so"'       '$3 = "usr/lib/VBoxOGLfeedbackspu.so=VBoxOGLfeedbackspu.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxOGLpassthroughspu.so=VBoxOGLpassthroughspu.so"' '$3 = "usr/lib/VBoxOGLpassthroughspu.so=VBoxOGLpassthroughspu.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxOGLarrayspu.so=VBoxOGLarrayspu.so"'             '$3 = "usr/lib/VBoxOGLarrayspu.so=VBoxOGLarrayspu.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxOGLerrorspu.so=VBoxOGLerrorspu.so"'             '$3 = "usr/lib/VBoxOGLerrorspu.so=VBoxOGLerrorspu.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxOGLpackspu.so=VBoxOGLpackspu.so"'               '$3 = "usr/lib/VBoxOGLpackspu.so=VBoxOGLpackspu.so"; $6="sys"'
-
-# crogl 64-bit opengl fixup
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGL.so=amd64/VBoxOGL.so"'                             '$3 = "usr/lib/amd64/VBoxOGL.so=amd64/VBoxOGL.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLcrutil.so=amd64/VBoxOGLcrutil.so"'                 '$3 = "usr/lib/amd64/VBoxOGLcrutil.so=amd64/VBoxOGLcrutil.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLfeedbackspu.so=amd64/VBoxOGLfeedbackspu.so"'       '$3 = "usr/lib/amd64/VBoxOGLfeedbackspu.so=amd64/VBoxOGLfeedbackspu.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLpassthroughspu.so=amd64/VBoxOGLpassthroughspu.so"' '$3 = "usr/lib/amd64/VBoxOGLpassthroughspu.so=amd64/VBoxOGLpassthroughspu.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLarrayspu.so=amd64/VBoxOGLarrayspu.so"'             '$3 = "usr/lib/amd64/VBoxOGLarrayspu.so=amd64/VBoxOGLarrayspu.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLerrorspu.so=amd64/VBoxOGLerrorspu.so"'             '$3 = "usr/lib/amd64/VBoxOGLerrorspu.so=amd64/VBoxOGLerrorspu.so"; $6="sys"'
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLpackspu.so=amd64/VBoxOGLpackspu.so"'               '$3 = "usr/lib/amd64/VBoxOGLpackspu.so=amd64/VBoxOGLpackspu.so"; $6="sys"'
-
-
-filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/vboxservice.xml=vboxservice.xml"'  '$3 = "var/svc/manifest/system/virtualbox/vboxservice.xml=vboxservice.xml"'
 echo " --- start of prototype  ---"
 cat prototype
Index: trunk/src/VBox/Additions/solaris/Installer/postinstall.sh
===================================================================
--- trunk/src/VBox/Additions/solaris/Installer/postinstall.sh	(revision 25681)
+++ trunk/src/VBox/Additions/solaris/Installer/postinstall.sh	(revision 25712)
@@ -130,12 +130,4 @@
     /usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
 fi
-if test ! -z "$xorgbin"; then
-    /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient=$vboxadditions_path/VBox.sh s
-    /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxRandR=$vboxadditions_path/VBoxRandR.sh s
-    /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient-all=$vboxadditions_path/1099.vboxclient s
-fi
-/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxControl=$vboxadditions_path/VBox.sh s
-/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxService=$vboxadditions_path/VBox.sh s
-
 
 # Install Xorg components to the required places
@@ -280,15 +272,18 @@
     echo "Configuring client..."
     vboxclient_src=$vboxadditions_path
+    vboxclient_dest="/usr/share/gnome/autostart"
+    clientinstalled=0
+    if test -d "$vboxclient_dest"; then
+        /usr/sbin/installf -c none $PKGINST $vboxclient_dest/vboxclient.desktop=$vboxadditions_path/vboxclient.desktop s
+        clientinstalled=1
+    fi
     vboxclient_dest="/usr/dt/config/Xsession.d"
     if test -d "$vboxclient_dest"; then
-        /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/1099.vboxclient" f
-        cp "$vboxclient_src/1099.vboxclient" "$vboxclient_dest/1099.vboxclient"
-        chmod a+rx "$vboxclient_dest/1099.vboxclient"
-    elif test -d "/usr/share/gnome/autostart"; then
-        vboxclient_dest="/usr/share/gnome/autostart"
-        /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/vboxclient.desktop" f
-        cp "$vboxclient_src/vboxclient.desktop" "$vboxclient_dest/vboxclient.desktop"
-    else
-        echo "*** Failed to configure client!! Couldn't find autostart directory."
+        /usr/sbin/installf -c none $PKGINST $vboxclient_dest/1099.vboxclient=$vboxadditions_path/1099.vboxclient s
+        clientinstalled=1
+    fi
+    if test $clientinstalled -eq 0; then
+        echo "*** Failed to configure client, couldn't find any autostart directory!"
+        # Exit as partially failed installation
         retval=2
     fi
