Index: /trunk/src/VBox/Additions/linux/export_modules
===================================================================
--- /trunk/src/VBox/Additions/linux/export_modules	(revision 58323)
+++ /trunk/src/VBox/Additions/linux/export_modules	(revision 58324)
@@ -16,4 +16,8 @@
 #
 
+# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+MY_DIR="${TARGET%/[!/]*}"
+
 if [ -z "$1" ]; then
     echo "Usage: $0 <filename.tar.gz>"
@@ -25,5 +29,5 @@
 PATH_OUT=$PATH_TMP
 FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
-PATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
+PATH_ROOT="${MY_DIR}/../../../..; pwd`"
 PATH_LINUX="$PATH_ROOT/src/VBox/Additions/linux"
 PATH_VBOXGUEST="$PATH_ROOT/src/VBox/Additions/common/VBoxGuest"
Index: /trunk/src/VBox/Additions/linux/installer/autorun.sh
===================================================================
--- /trunk/src/VBox/Additions/linux/installer/autorun.sh	(revision 58323)
+++ /trunk/src/VBox/Additions/linux/installer/autorun.sh	(revision 58324)
@@ -27,6 +27,8 @@
 fi
 
+# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+path="${TARGET%/[!/]*}"
 # 32-bit or 64-bit?
-path=`dirname $0`
 case `uname -m` in
   i[3456789]86|x86|i86pc)
Index: /trunk/src/VBox/HostDrivers/linux/export_modules
===================================================================
--- /trunk/src/VBox/HostDrivers/linux/export_modules	(revision 58323)
+++ /trunk/src/VBox/HostDrivers/linux/export_modules	(revision 58324)
@@ -15,4 +15,8 @@
 #
 
+# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+MY_DIR="${TARGET%/[!/]*}"
+
 if [ -z "$1" ]; then
     echo "Usage: $0 <filename.tar.gz> [--without-hardening]"
@@ -29,5 +33,5 @@
 PATH_OUT=$PATH_TMP
 FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
-PATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
+PATH_ROOT="${MY_DIR}/../../../..; pwd`"
 PATH_LINUX="$PATH_ROOT/src/VBox/HostDrivers/linux"
 PATH_VBOXDRV="$PATH_ROOT/src/VBox/HostDrivers/Support"
Index: /trunk/src/VBox/HostDrivers/linux/load.sh
===================================================================
--- /trunk/src/VBox/HostDrivers/linux/load.sh	(revision 58323)
+++ /trunk/src/VBox/HostDrivers/linux/load.sh	(revision 58324)
@@ -16,10 +16,7 @@
 #
 
-MY_DIR=`dirname "$0"`
-MY_DIR=`cd "${MY_DIR}" && pwd`
-if [ ! -d "${MY_DIR}" ]; then
-    echo "Cannot find ${MY_DIR} or it's not a directory..."
-    exit 1;
-fi
+# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+MY_DIR="${TARGET%/[!/]*}"
 
 set -e
Index: /trunk/src/VBox/HostDrivers/linux/loadall.sh
===================================================================
--- /trunk/src/VBox/HostDrivers/linux/loadall.sh	(revision 58323)
+++ /trunk/src/VBox/HostDrivers/linux/loadall.sh	(revision 58324)
@@ -16,10 +16,7 @@
 #
 
-MY_DIR=`dirname "$0"`
-MY_DIR=`cd "${MY_DIR}" && pwd`
-if [ ! -d "${MY_DIR}" ]; then
-    echo "Cannot find ${MY_DIR} or it's not a directory..."
-    exit 1;
-fi
+# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+MY_DIR="${TARGET%/[!/]*}"
 
 if test ${#} -eq 0; then
Index: /trunk/src/VBox/Installer/linux/postinst-common.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/postinst-common.sh	(revision 58323)
+++ /trunk/src/VBox/Installer/linux/postinst-common.sh	(revision 58324)
@@ -23,11 +23,11 @@
 # (e.g. /opt/VirtualBox, /usr/lib/VirtualBox, the build output directory).
 
-# This is GNU-specific, sorry Solaris.  It fails on directories ending in '\n'.
-MY_PATH="$(dirname $(readlink -f -- "${0}"))"
+# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+MY_PATH="${TARGET%/[!/]*}"
 cd "${MY_PATH}"
 . "./routines.sh"
 
 START=true
-TARGET="${MY_PATH}"
 while test -n "${1}"; do
     case "${1}" in
@@ -49,8 +49,8 @@
 
 # Install runlevel scripts and systemd unit files
-install_init_script "${TARGET}/vboxdrv.sh" vboxdrv
-install_init_script "${TARGET}/vboxballoonctrl-service.sh" vboxballoonctrl-service
-install_init_script "${TARGET}/vboxautostart-service.sh" vboxautostart-service
-install_init_script "${TARGET}/vboxweb-service.sh" vboxweb-service
+install_init_script "${MY_PATH}/vboxdrv.sh" vboxdrv
+install_init_script "${MY_PATH}/vboxballoonctrl-service.sh" vboxballoonctrl-service
+install_init_script "${MY_PATH}/vboxautostart-service.sh" vboxautostart-service
+install_init_script "${MY_PATH}/vboxweb-service.sh" vboxweb-service
 
 delrunlevel vboxdrv
Index: /trunk/src/VBox/Installer/linux/prerm-common.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/prerm-common.sh	(revision 58323)
+++ /trunk/src/VBox/Installer/linux/prerm-common.sh	(revision 58324)
@@ -27,6 +27,7 @@
 # error).
 
-# This is GNU-specific, sorry Solaris.
-MY_PATH="$(dirname $(readlink -f -- "${0}"))/"
+# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+MY_PATH="${TARGET%/[!/]*}"
 cd "${MY_PATH}"
 . "./routines.sh"
Index: /trunk/src/VBox/Installer/linux/uninstall.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/uninstall.sh	(revision 58323)
+++ /trunk/src/VBox/Installer/linux/uninstall.sh	(revision 58324)
@@ -16,5 +16,8 @@
 #
 
-. `dirname $0`/routines.sh
+# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+MY_PATH="${TARGET%/[!/]*}"
+. "${MY_PATH}/routines.sh"
 
 if [ -z "$ro_LOG_FILE" ]; then
@@ -49,5 +52,5 @@
 # Do pre-removal common to all installer types, currently service script
 # clean-up.
-`dirname $0`/prerm-common.sh || exit 1  # Arguments intentionally not quoted.
+"${MY_PATH}/prerm-common.sh" || exit 1
 
 # Remove kernel module installed
Index: /trunk/src/VBox/Installer/linux/vboxdrv.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/vboxdrv.sh	(revision 58323)
+++ /trunk/src/VBox/Installer/linux/vboxdrv.sh	(revision 58324)
@@ -32,6 +32,8 @@
 MODPROBE=/sbin/modprobe
 SCRIPTNAME=vboxdrv
-# This is GNU-specific, sorry Solaris.  It fails on directories ending in '\n'.
-SCRIPT_DIR="$(dirname $(readlink -f -- "${0}"))"
+
+# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
+TARGET=`readlink -e -- "${0}"` || exit 1
+SCRIPT_DIR="${TARGET%/[!/]*}"
 
 if $MODPROBE -c | grep -q '^allow_unsupported_modules  *0'; then
