Date: Saturday, April 7, 2018 @ 20:15:55
  Author: foutrelis
Revision: 314910

upgpkg: virtualbox 5.2.8-2

Fix virtualbox-guest-dkms to work with different kernel versions:

  - for kernels earlier than Linux 4.16; it will build all 3 modules
  - for Linux 4.16; it will only build vboxsf (the mainline version)
  - for future kernels (4.17 and later); it will not build anything

Also patch VBoxService to fix automounting of shares on Linux 4.16.

The following error will be printed when VBoxService tries to mount
a shared directory and also when vboxsf.mount is used on Linux 4.16:

    vboxsf: Old binary mount data not supported, remove obsolete
    mount.vboxsf and/or update your VBoxService.

Despite the above error, the shared directories should be mounted (or,
in the case of vboxsf.mount, show a suggestion to use: mount -cit ...)

Added:
  virtualbox/trunk/linux-4.16-mount-fixes.patch
  virtualbox/trunk/virtualbox-vboxsf-4.16-dkms.conf
Modified:
  virtualbox/trunk/PKGBUILD
  virtualbox/trunk/virtualbox-guest-dkms.conf

----------------------------------+
 PKGBUILD                         |   25 +++++++++++++++++++++----
 linux-4.16-mount-fixes.patch     |   35 +++++++++++++++++++++++++++++++++++
 virtualbox-guest-dkms.conf       |    3 +++
 virtualbox-vboxsf-4.16-dkms.conf |   10 ++++++++++
 4 files changed, 69 insertions(+), 4 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2018-04-07 20:12:45 UTC (rev 314909)
+++ PKGBUILD    2018-04-07 20:15:55 UTC (rev 314910)
@@ -11,7 +11,7 @@
          'virtualbox-guest-utils-nox'
          'virtualbox-ext-vnc')
 pkgver=5.2.8
-pkgrel=1
+pkgrel=2
 arch=('x86_64')
 url='http://virtualbox.org'
 license=('GPL' 'custom')
@@ -21,6 +21,7 @@
              'curl'
              'dev86'
              'device-mapper'
+             'git'
              'glu'
              'gsoap'
              'iasl'
@@ -69,10 +70,15 @@
         '007-python2-path.patch'
         '008-no-vboxvideo.patch'
         '009-include-path.patch'
+        'linux-4.16-mount-fixes.patch'
+        # We need to build a modified version of vboxsf for Linux 4.16
+        # https://bugzilla.redhat.com/show_bug.cgi?id=1481630#c65
+        "git+https://github.com/jwrdegoede/vboxsf#commit=$_vboxsf_commit";
+        'virtualbox-vboxsf-4.16-dkms.conf'
         )
 sha256sums=('ee2759d47b0b4ac81b8b671c9485c87fb2db12c097b3e7e69b94c1291a8084e8'
             'deb03efa7ad0376aa55a087f2e882afe00935f10b0e7aa853ba9147090d341ec'
-            '113f9b92141b85df01f1e74d22f01d1f1aa81650eb79b89ceefc3cae20afe2e2'
+            'c328376b05183d269f98319ec660f54c55e298f77d229977606862b064651a7c'
             '2101ebb58233bbfadf3aa74381f22f7e7e508559d2b46387114bc2d8e308554c'
             'da4c49f6ca94e047e196cdbcba2c321199f4760056ea66e0fbc659353e128c9e'
             '9c5238183019f9ebc7d92a8582cad232f471eab9d3278786225abc1a1c7bf66e'
@@ -88,7 +94,9 @@
             '6bdb017459532537199c399eefd3d84d8dc7f1786e79997caebd3b6eb5c75d9f'
             '8b7f241107863f82a5b0ae336aead0b3366a40103ff72dbebf33f54b512a0cbc'
             '1acc7014bcb3d9ca6da29eed813c3d6e91a688c43f9d93802fd4e3814f67ace4'
-            )
+            'c3dc5a771a1acab274cd10e5305982aa9c149cd94ed4c71c7805327020d4d741'
+            'SKIP'
+            '889266d15d45b2aca7699eec939c603149fbf536cf93091d9ad846d232cf3259')
 
 prepare() {
     cd "VirtualBox-$pkgver"
@@ -247,8 +255,8 @@
     pushd sdk/installer
     VBOX_INSTALL_PATH="/usr/lib/virtualbox" python2 vboxapisetup.py install 
--root "$pkgdir"
     popd
-    rm -rf sdk/installer
     cp -r sdk "$pkgdir/usr/lib/virtualbox"
+    rm -r "$pkgdir/usr/lib/virtualbox/sdk/installer"
     # licence
     install -Dm644 "$srcdir/VirtualBox-$pkgver/COPYING" \
         "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
@@ -312,6 +320,15 @@
     local _p="$pkgdir/usr/src/vboxguest-${pkgver}_OSE/dkms.conf"
     install -Dm644 "$srcdir/$pkgname.conf" "$_p"
     sed -i "s,@VERSION@,$pkgver," "$_p"
+
+    # vboxsf module for Linux 4.16
+    install -d "$pkgdir/usr/src/vboxsf-4.16-${pkgver}_OSE"
+    cp -rT "$srcdir/vboxsf" "$pkgdir/usr/src/vboxsf-4.16-${pkgver}_OSE/vboxsf"
+    rm -rf "$pkgdir/usr/src/vboxsf-4.16-${pkgver}_OSE/vboxsf/.git"
+    echo "obj-m = vboxsf/" 
>"$pkgdir/usr/src/vboxsf-4.16-${pkgver}_OSE/Makefile"
+    local _p="$pkgdir/usr/src/vboxsf-4.16-${pkgver}_OSE/dkms.conf"
+    install -Dm644 "$srcdir/virtualbox-vboxsf-4.16-dkms.conf" "$_p"
+    sed -i "s,@VERSION@,$pkgver," "$_p"
 }
 
 package_virtualbox-guest-utils() {

Added: linux-4.16-mount-fixes.patch
===================================================================
--- linux-4.16-mount-fixes.patch                                (rev 0)
+++ linux-4.16-mount-fixes.patch        2018-04-07 20:15:55 UTC (rev 314910)
@@ -0,0 +1,35 @@
+This ghetto patch attempts to fix shared folder automounting for guests running
+Linux 4.16, and also suggests an alternative to mount.vboxsf.
+
+diff -uprb 
VirtualBox-5.2.8.orig/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
 VirtualBox-5.2.8/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
+--- 
VirtualBox-5.2.8.orig/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
       2018-02-26 17:57:30.000000000 +0200
++++ 
VirtualBox-5.2.8/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp 
   2018-04-07 21:00:05.785735622 +0300
+@@ -346,6 +346,13 @@ static int vbsvcAutoMountSharedFolder(co
+                       "vboxsf",
+                       fFlags,
+                       &mntinf);
++        if (r == -1 && errno == EINVAL)
++        {
++            /* Mainline vboxsf accepts regular mount opts. */
++            char mount_opts[1024];
++            snprintf(mount_opts, 1024, "gid=%d,dmode=0770,fmode=0770", 
mntinf.gid);
++            r = mount(pszShareName, pszMountPoint, "vboxsf", fFlags, 
mount_opts);
++        }
+         if (r == 0)
+         {
+             VGSvcVerbose(0, "vbsvcAutoMountWorker: Shared folder '%s' was 
mounted to '%s'\n", pszShareName, pszMountPoint);
+diff -uprb 
VirtualBox-5.2.8.orig/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c 
VirtualBox-5.2.8/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c
+--- 
VirtualBox-5.2.8.orig/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c     
   2018-02-26 17:57:34.000000000 +0200
++++ VirtualBox-5.2.8/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c     
2018-04-07 21:39:38.121577588 +0300
+@@ -485,6 +485,11 @@ main(int argc, char **argv)
+      *       to keep this code here slick without having VbglR3.
+      */
+     err = mount(host_name, mount_point, "vboxsf", flags, &mntinf);
++    if (err == -1 && errno == EINVAL)
++    {
++        /* The mount.vboxsf helper should not be used with mainline vboxsf. */
++        panic("mount.vboxsf cannot be used with mainline vboxsf; instead 
use:\n\n    mount -cit vboxsf NAME MOUNTPOINT\n\n");
++    }
+     if (err == -1 && errno == EPROTO)
+     {
+         /* Sometimes the mount utility messes up the share name.  Try to

Modified: virtualbox-guest-dkms.conf
===================================================================
--- virtualbox-guest-dkms.conf  2018-04-07 20:12:45 UTC (rev 314909)
+++ virtualbox-guest-dkms.conf  2018-04-07 20:15:55 UTC (rev 314910)
@@ -18,6 +18,9 @@
 PACKAGE_VERSION=@VERSION@_OSE
 AUTOINSTALL=yes
 
+# Build only for kernels before Linux 4.16
+BUILD_EXCLUSIVE_KERNEL="^(4\.[0-9]\..*|4\.1[0-5]\..*|3\..*)"
+
 BUILT_MODULE_NAME[0]="vboxguest"
 BUILT_MODULE_LOCATION[0]="vboxguest"
 DEST_MODULE_LOCATION[0]="/kernel/misc"

Added: virtualbox-vboxsf-4.16-dkms.conf
===================================================================
--- virtualbox-vboxsf-4.16-dkms.conf                            (rev 0)
+++ virtualbox-vboxsf-4.16-dkms.conf    2018-04-07 20:15:55 UTC (rev 314910)
@@ -0,0 +1,10 @@
+PACKAGE_NAME="vboxsf-4.16"
+PACKAGE_VERSION=@VERSION@_OSE
+AUTOINSTALL=yes
+
+# Build only for Linux 4.16
+BUILD_EXCLUSIVE_KERNEL="^4\.16\.*"
+
+BUILT_MODULE_NAME[0]="vboxsf"
+BUILT_MODULE_LOCATION[0]="vboxsf"
+DEST_MODULE_LOCATION[0]="/kernel/misc"

Reply via email to