Index: /trunk/src/VBox/Installer/linux/install.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/install.sh	(revision 39221)
+++ /trunk/src/VBox/Installer/linux/install.sh	(revision 39222)
@@ -338,17 +338,6 @@
 
     # XXX SELinux: allow text relocation entries
-    if [ -x /usr/bin/chcon ]; then
-        chcon -t texrel_shlib_t $INSTALLATION_DIR/VBox* > /dev/null 2>&1
-        chcon -t texrel_shlib_t $INSTALLATION_DIR/VBoxAuth.so > /dev/null 2>&1
-        chcon -t texrel_shlib_t $INSTALLATION_DIR/VirtualBox.so > /dev/null 2>&1
-        chcon -t texrel_shlib_t $INSTALLATION_DIR/components/VBox*.so > /dev/null 2>&1
-        chcon -t java_exec_t    $INSTALLATION_DIR/VirtualBox > /dev/null 2>&1
-        chcon -t java_exec_t    $INSTALLATION_DIR/VBoxSDL > /dev/null 2>&1
-        chcon -t java_exec_t    $INSTALLATION_DIR/VBoxHeadless > /dev/null 2>&1
-        chcon -t java_exec_t    $INSTALLATION_DIR/VBoxNetDHCP > /dev/null 2>&1
-        chcon -t java_exec_t    $INSTALLATION_DIR/VBoxExtPackHelperApp > /dev/null 2>&1
-        chcon -t java_exec_t    $INSTALLATION_DIR/vboxwebsrv > /dev/null 2>&1
-        chcon -t java_exec_t    $INSTALLATION_DIR/webtest > /dev/null 2>&1
-    fi
+    set_selinux_permissions "$INSTALLATION_DIR" \
+                            "$INSTALLATION_DIR"
 
     # Hardened build: Mark selected binaries set-user-ID-on-execution,
Index: /trunk/src/VBox/Installer/linux/installer-utils.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/installer-utils.sh	(revision 39221)
+++ /trunk/src/VBox/Installer/linux/installer-utils.sh	(revision 39222)
@@ -13,4 +13,7 @@
 # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 #
+
+## @todo Make this file into a script in the VirtualBox lib directory once
+#        enough code has been made shared between the different installers.
 
 # This is used for unit testing and will be reset after the file is sourced for
@@ -148,2 +151,29 @@
     done
 }
+
+set_selinux_permissions() {
+    # XXX SELinux: allow text relocation entries
+    INSTALLATION_DIR="$1"  # Where the VirtualBox binaries are installed to
+    SHARE_DIR="$2"         # Where shared bits are installed to
+    if [ -x /usr/bin/chcon ]; then
+        chcon -t texrel_shlib_t "$INSTALLATION_DIR"/*VBox* > /dev/null 2>&1
+        chcon -t texrel_shlib_t "$INSTALLATION_DIR"/VBoxAuth.so \
+            > /dev/null 2>&1
+        chcon -t texrel_shlib_t "$INSTALLATION_DIR"/VirtualBox.so \
+            > /dev/null 2>&1
+        chcon -t texrel_shlib_t "$INSTALLATION_DIR"/components/VBox*.so \
+            > /dev/null 2>&1
+        chcon -t java_exec_t    "$INSTALLATION_DIR"/VirtualBox > /dev/null 2>&1
+        chcon -t java_exec_t    "$INSTALLATION_DIR"/VBoxSDL > /dev/null 2>&1
+        chcon -t java_exec_t    "$INSTALLATION_DIR"/VBoxHeadless \
+            > /dev/null 2>&1
+        chcon -t java_exec_t    "$INSTALLATION_DIR"/VBoxNetDHCP \
+            > /dev/null 2>&1
+        chcon -t java_exec_t    "$INSTALLATION_DIR"/VBoxExtPackHelperApp \
+            > /dev/null 2>&1
+        chcon -t java_exec_t    "$INSTALLATION_DIR"/vboxwebsrv > /dev/null 2>&1
+        chcon -t java_exec_t    "$INSTALLATION_DIR"/webtest > /dev/null 2>&1
+        chcon -t bin_t          "$SHARE_DIR"/src/vboxhost/*/build_in_tmp \
+             > /dev/null 2>&1
+    fi
+}
Index: /trunk/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
===================================================================
--- /trunk/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec	(revision 39221)
+++ /trunk/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec	(revision 39222)
@@ -239,16 +239,5 @@
 # XXX SELinux: allow text relocation entries
 %if %{?rpm_redhat:1}%{!?rpm_redhat:0}
-if [ -x /usr/bin/chcon ]; then
-  chcon -t texrel_shlib_t /usr/lib/virtualbox/*VBox* > /dev/null 2>&1
-  chcon -t texrel_shlib_t /usr/lib/virtualbox/VirtualBox.so > /dev/null 2>&1
-  chcon -t texrel_shlib_t /usr/lib/virtualbox/VBoxAuth.so > /dev/null 2>&1
-  chcon -t texrel_shlib_t /usr/lib/virtualbox/components/VBox*.so > /dev/null 2>&1
-  chcon -t java_exec_t    /usr/lib/virtualbox/VirtualBox > /dev/null 2>&1
-  chcon -t java_exec_t    /usr/lib/virtualbox/VBoxSDL > /dev/null 2>&1
-  chcon -t java_exec_t    /usr/lib/virtualbox/VBoxHeadless > /dev/null 2>&1
-  chcon -t java_exec_t    /usr/lib/virtualbox/VBoxExtPackHelperApp > /dev/null 2>&1
-  chcon -t java_exec_t    /usr/lib/virtualbox/VBoxBalloonCtrl > /dev/null 2>&1
-  chcon -t java_exec_t    /usr/lib/virtualbox/vboxwebsrv > /dev/null 2>&1
-fi
+set_selinux_permissions /usr/lib/virtualbox /usr/share/virtualbox
 %endif
 
