Hello community,

here is the log from the commit of package virtualbox for openSUSE:Factory 
checked in at 2017-07-04 11:54:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/virtualbox (Old)
 and      /work/SRC/openSUSE:Factory/.virtualbox.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "virtualbox"

Tue Jul  4 11:54:03 2017 rev:135 rq:507206 version:5.1.22

Changes:
--------
--- /work/SRC/openSUSE:Factory/virtualbox/virtualbox.changes    2017-05-27 
13:09:52.451530641 +0200
+++ /work/SRC/openSUSE:Factory/.virtualbox.new/virtualbox.changes       
2017-07-04 11:54:05.989630428 +0200
@@ -1,0 +2,43 @@
+Fri Jun 30 00:50:42 UTC 2017 - larry.fin...@lwfinger.net
+
+- Fix missing global for 32-bit version with gcc7. (bsc#1046571).
+  Fix missing frame buffer cleanup - private communication from Oracle - adds 
file "fix_KMS_support.patch".
+
+-------------------------------------------------------------------
+Sun Jun 25 17:09:01 UTC 2017 - larry.fin...@lwfinger.net
+
+- Fix logic error in scripts to build kernel modules locally - see bnc#1042726.
+  Fix "requires" for net-tools-deprecated so that Leap 42.3 will build.
+  Fix missing /media for Leap 42.3.
+  Fix typo in above changes.
+
+-------------------------------------------------------------------
+Sun Jun 25 00:20:08 UTC 2017 - larry.fin...@lwfinger.net
+
+- Fix some typos in the various service files as noted in boo#1044931.
+  With these fixes, TW guests start correctly. In addition, the 
/sbin/vboxconfig (for hosts) and the
+  /sbin/vboxguestconfig (for guests) work correctly.
+
+-------------------------------------------------------------------
+Wed Jun 21 16:46:48 UTC 2017 - larry.fin...@lwfinger.net
+
+- Now that kernel:HEAD:standard has changed to version 4.12.0-rcX, the VB 
drivers need some changes for new API's.
+  File "vbox_fix_for_kernel_4.12.patch" is added.
+  The added installation of "net-tools-deprecated" broke builds for Leap 42.3. 
That change is now conditional on building for Factory.
+-------------------------------------------------------------------
+Sat Jun 10 13:19:05 UTC 2017 - larry.fin...@lwfinger.net
+
+- Add installation of package "net-tools-deprecated" as requested in 
boo#1027742.
+
+-------------------------------------------------------------------
+Thu Jun  8 17:37:35 UTC 2017 - larry.fin...@lwfinger.net
+
+- Revise warning screen concerning USB passthru - fixes bnc#1041137.
+  USB passthru opens a security hole, yet it is so valuable that many users 
want the feature, thus it is our default.
+  Previously, a user needed to edit a udev rule to disable passthru. The bad 
part was that an update of VB changed the
+  rule back to allow passthru without any notification. These changes modify 
the popup to allow the user to accept or decline
+  passthru. If the user declines, then the root password is requested and the 
udev rule is modified. As these modifications will be
+  lost with the next VB update, the inode of the udev rule is kept. If the 
user has previously declined and the inode has changed,
+  the popup will show the next time VB is started. File "fix_usb_rules.sh" is 
added.
+
+-------------------------------------------------------------------

New:
----
  fix_KMS_support.patch
  fix_usb_rules.sh
  vbox_fix_for_kernel_4.12.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ virtualbox.spec ++++++
--- /var/tmp/diff_new_pack.SV6b24/_old  2017-07-04 11:54:08.825231377 +0200
+++ /var/tmp/diff_new_pack.SV6b24/_new  2017-07-04 11:54:08.829230814 +0200
@@ -51,6 +51,7 @@
 Source15:       vboxadd-service.service
 Source16:       vboxconfig.sh
 Source17:       vboxguestconfig.sh
+Source18:       fix_usb_rules.sh
 Source98:       %{name}-rpmlintrc
 Source99:       %{name}-patch-source.sh
 #rework init scripts to fit suse needs
@@ -100,6 +101,10 @@
 Patch115:       vbox_fix_for_gcc7.patch
 # Fix for missing include needed for server 1.19
 Patch116:       Fix_for_server_1.19.patch
+# Fix for kernel 4.12 API changes
+Patch117:       vbox_fix_for_kernel_4.12.patch
+# Fix for missing cleanup in KMS support
+Patch118:       fix_KMS_support.patch
 #
 BuildRequires:  LibVNCServer-devel
 BuildRequires:  SDL-devel
@@ -172,6 +177,9 @@
 Requires:       %{name}-host-kmp = %{version}
 Requires(post): sysvinit(syslog)
 Requires(pre):  permissions
+%if ! 0%{?suse_version} > 1325
+Requires(pre):  net-tools-deprecated
+%endif
 Requires(pre):  pwdutils
 Requires(pre):  %insserv_prereq
 Requires(pre):  %fillup_prereq
@@ -268,6 +276,9 @@
 Provides:       %{name}-ose-guest-tools = %{version}
 Obsoletes:      %{name}-ose-guest-tools < %{version}
 Requires(pre):  %insserv_prereq
+%if ! 0%{?suse_version} > 1325
+Requires(pre):  net-tools-deprecated
+%endif
 
 %description guest-tools
 VirtualBox guest addition tools.
@@ -374,6 +385,8 @@
 %endif
 %patch115 -p1
 %patch116 -p1
+%patch117 -p1
+%patch118 -p1
 
 #copy user manual
 cp %{SOURCE1} UserManual.pdf
@@ -540,7 +553,7 @@
 # udev rule for guest (virtualbox-guest-tools)
 install -m 644 %{SOURCE3}                      
%{buildroot}%{_udevrulesdir}/60-vboxguest.rules
 # /media is used for auto-mounting of shared folders
-%if 0%{?suse_version} > 1310
+%if 0%{?suse_version} > 1320 || 0%{?sle_version} == 120300
 install -d -m 755 %{buildroot}/media
 %endif
 #
@@ -620,7 +633,6 @@
 install -m 644 %{SOURCE4}                      
%{buildroot}%{_sysconfdir}/default/virtualbox
 #install wrapper script
 install -m 644 %{SOURCE9}                      
%{buildroot}%{_bindir}/VirtualBox
-
 # modify and install the vboxdrv init script
 sed -i "s|%{NOLSB}%|yes|g;s|%{DEBIAN}%||g;s|%{PACKAGE}%|virtualbox|g" \
                                                
src/VBox/Installer/linux/vboxdrv.sh
@@ -628,14 +640,15 @@
 ln -s %{_sysconfdir}/init.d/vboxdrv %{buildroot}%{_sbindir}/rcvboxdrv
 # Service files to load kernel modules on boot
 install -m 0644 %{SOURCE14}                    
%{buildroot}%{_unitdir}/vboxdrv.service
-install -m 0644 %{SOURCE14}                    
%{buildroot}%{_unitdir}/multi-user.target.wants/vboxdrv.service
 install -m 0644 %{SOURCE15}                    
%{buildroot}%{_unitdir}/vboxadd-service.service
-install -m 0644 %{SOURCE15}                    
%{buildroot}%{_unitdir}/multi-user.target.wants/vboxadd-service.service
-install -m 0644 %{SOURCE16}                    %{buildroot}/sbin/vboxconfig
-install -m 0644 %{SOURCE17}                    
%{buildroot}/sbin/vboxguestconfig
+install -m 0755 %{SOURCE16}                    %{buildroot}/sbin/vboxconfig
+install -m 0755 %{SOURCE17}                    
%{buildroot}/sbin/vboxguestconfig
+install -m 0755 %{SOURCE18}                    
%{buildroot}/sbin/vbox-fix-usb-rules.sh
 # Init script to start virtual boxes during boot
 install -m 755 %{SOURCE12} %{buildroot}%{_sysconfdir}/init.d/vboxes
 ln -s %{_sysconfdir}/init.d/vboxes %{buildroot}%{_sbindir}/rcvboxes
+ln -sf %{_unitdir}/vboxdrv.service             
%{buildroot}%{_unitdir}/multi-user.target.wants/vboxdrv.service
+ln -sf %{_unitdir}/vboxadd-service.service     
%{buildroot}%{_unitdir}/multi-user.target.wants/vboxadd-service.service
 # sysconfig file intended for vboxes script
 install -d -m 755 %{buildroot}%{_var}/adm/fillup-templates
 install -m 640 %{SOURCE13} 
%{buildroot}%{_var}/adm/fillup-templates/sysconfig.vbox
@@ -881,6 +894,8 @@
 %verify(not mode) %attr(4750,root,vboxusers) %{_vbox_instdir}/VirtualBox
 #wrapper script is in bindir
 %attr(0755,root,root) %{_bindir}/VirtualBox
+#rules fixing script is in /sbin
+%attr(0755,root,root) /sbin/vbox-fix-usb-rules.sh
 #ldd shows libQt* dependency
 %{_vbox_instdir}/VBoxTestOGL
 #qm's translations
@@ -915,7 +930,7 @@
 %{_unitdir}/multi-user.target.wants/vboxadd-service.service
 %{_sbindir}/rcvboxadd
 %{_sbindir}/rcvboxadd-service
-%if 0%{?suse_version} > 1310
+%if 0%{?suse_version} > 1320 || 0%{?sle_version} == 120300
 %dir /media
 %endif
 

++++++ fix_KMS_support.patch ++++++
Index: VirtualBox-5.1.22/src/VBox/Additions/linux/drm/vbox_fb.c
===================================================================
--- VirtualBox-5.1.22.orig/src/VBox/Additions/linux/drm/vbox_fb.c
+++ VirtualBox-5.1.22/src/VBox/Additions/linux/drm/vbox_fb.c
@@ -409,6 +409,9 @@ static void vbox_fbdev_destroy(struct dr
     LogFunc(("vboxvideo: %d\n", __LINE__));
     if (fbdev->helper.fbdev) {
         info = fbdev->helper.fbdev;
+#ifdef CONFIG_FB_DEFERRED_IO
+       fb_deferred_io_cleanup(info);
+#endif
         unregister_framebuffer(info);
         if (info->cmap.len)
             fb_dealloc_cmap(&info->cmap);
++++++ fix_usb_rules.sh ++++++
#!/bin/bash
# script to disable USB passthru in /etc/udev/rules.d/60-vboxdrv.rules
# if already disabled, clear the comment character
sed -i 's/#SUBSYSTEM==\"usb/SUBSYSTEM==\"usb/' 
/etc/udev/rules.d/60-vboxdrv.rules
# now comment the usb lines
sed -i 's/SUBSYSTEM==\"usb/#SUBSYSTEM==\"usb/' 
/etc/udev/rules.d/60-vboxdrv.rules

++++++ modify_for_4_8_bo_move.patch ++++++
--- /var/tmp/diff_new_pack.SV6b24/_old  2017-07-04 11:54:08.921217869 +0200
+++ /var/tmp/diff_new_pack.SV6b24/_new  2017-07-04 11:54:08.921217869 +0200
@@ -1,8 +1,8 @@
-Index: VirtualBox-5.1.6/src/VBox/Additions/linux/drm/vbox_ttm.c
+Index: VirtualBox-5.1.22/src/VBox/Additions/linux/drm/vbox_ttm.c
 ===================================================================
---- VirtualBox-5.1.6.orig/src/VBox/Additions/linux/drm/vbox_ttm.c
-+++ VirtualBox-5.1.6/src/VBox/Additions/linux/drm/vbox_ttm.c
-@@ -229,7 +229,6 @@ static int vbox_bo_move(struct ttm_buffe
+--- VirtualBox-5.1.22.orig/src/VBox/Additions/linux/drm/vbox_ttm.c
++++ VirtualBox-5.1.22/src/VBox/Additions/linux/drm/vbox_ttm.c
+@@ -231,7 +231,6 @@ static int vbox_bo_move(struct ttm_buffe
      return r;
  }
  
@@ -10,10 +10,10 @@
  static void vbox_ttm_backend_destroy(struct ttm_tt *tt)
  {
      ttm_tt_fini(tt);
-Index: VirtualBox-5.1.6/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
+Index: VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
 ===================================================================
---- VirtualBox-5.1.6.orig/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
-+++ VirtualBox-5.1.6/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
+--- VirtualBox-5.1.22.orig/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
++++ VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
 @@ -35,7 +35,7 @@
  #include <iprt/assert.h>
  #include <iprt/err.h>

++++++ vbox-usb-warning.diff ++++++
--- /var/tmp/diff_new_pack.SV6b24/_old  2017-07-04 11:54:08.973210552 +0200
+++ /var/tmp/diff_new_pack.SV6b24/_new  2017-07-04 11:54:08.973210552 +0200
@@ -1,10 +1,8 @@
-Index: a/src/apps/Makefile.kmk
+Index: VirtualBox-5.1.22/src/apps/Makefile.kmk
 ===================================================================
---- a/src/apps/Makefile.kmk    (revision 58576)
-+++ b/src/apps/Makefile.kmk    (working copy)
-@@ -34,7 +34,9 @@
-  endif
- endif
+--- VirtualBox-5.1.22.orig/src/apps/Makefile.kmk
++++ VirtualBox-5.1.22/src/apps/Makefile.kmk
+@@ -31,5 +31,7 @@ endif
  
  include $(PATH_SUB_CURRENT)/VBoxPermissionMessage/Makefile.kmk
  
@@ -12,10 +10,10 @@
 +
  include $(FILE_KBUILD_SUB_FOOTER)
  
-Index: a/src/apps/VBoxUSB_DevRules/Makefile.kmk
+Index: VirtualBox-5.1.22/src/apps/VBoxUSB_DevRules/Makefile.kmk
 ===================================================================
---- a/src/apps/VBoxUSB_DevRules/Makefile.kmk   (revision 0)
-+++ b/src/apps/VBoxUSB_DevRules/Makefile.kmk   (working copy)
+--- /dev/null
++++ VirtualBox-5.1.22/src/apps/VBoxUSB_DevRules/Makefile.kmk
 @@ -0,0 +1,33 @@
 +# $Id: Makefile.kmk 28800 2010-04-27 08:22:32Z vboxsync $
 +## @file
@@ -50,21 +48,34 @@
 +include $(KBUILD_PATH)/subfooter.kmk
 +
 +
-Index: a/src/apps/VBoxUSB_DevRules/VBoxUSB_DevRules.cpp
+Index: VirtualBox-5.1.22/src/apps/VBoxUSB_DevRules/VBoxUSB_DevRules.cpp
 ===================================================================
---- a/src/apps/VBoxUSB_DevRules/VBoxUSB_DevRules.cpp   (revision 0)
-+++ b/src/apps/VBoxUSB_DevRules/VBoxUSB_DevRules.cpp   (working copy)
-@@ -0,0 +1,13 @@
+--- /dev/null
++++ VirtualBox-5.1.22/src/apps/VBoxUSB_DevRules/VBoxUSB_DevRules.cpp
+@@ -0,0 +1,26 @@
 +#include <QtWidgets/QApplication>
 +#include <QtWidgets/QMessageBox>
++#include <QtWidgets/QPushButton>
++
 +int main(int argc, char *argv[])
 +{
 +        QApplication app(argc, argv);
 +        QMessageBox msgBox;
-+        msgBox.setWindowTitle(QObject::tr("USB Rules and Permissions !"));
-+        msgBox.setText(QObject::tr("USB passthru opens a security hole. 
Please read \n\nhttps://bugzilla.novell.com/show_bug.cgi?id=664520\n\nto 
understand the problem. If you really want/need to use USB passthru and are 
willing to accept the security risk, then do nothing. To plug the security 
hole, remove all 'usb' lines from /etc/udev/rules.d/60-vboxdrv.rules.\n\nThis 
message will not be seen again!"));
-+        int ret = msgBox.exec();
++      QPushButton *myYesButton = msgBox.addButton("Enable", 
QMessageBox::YesRole);
++      QPushButton *myNoButton = msgBox.addButton("Disable", 
QMessageBox::NoRole);
++      msgBox.setWindowTitle(QObject::tr("USB Rules and Permissions !"));
++        msgBox.setText(QObject::tr("USB passthru opens a security hole. "
++                      "Please read 
\nhttps://bugzilla.novell.com/show_bug.cgi?id=664520\n";
++                      "to understand the problem.\n\nWe regard USB passthru 
to be extremely useful and worth the security risk. "
++                      "thus the code defaults to enabling this feature. If 
you agree that the risk is acceptible, then click 'Enable'.\n"
++                      "You will not be asked this question again when VB is 
updated. If you later change your mind, run 'rm ~/.vbox/*'\n\n"
++                      "If you wish to disable USB passthru to plug the 
security hole, then click 'Disable'. "
++                      "You will be asked for the system password, and 
/etc/udev/rules.d/60-vboxdrv.rules will be changed.\n"
++                      "These changes cannot be preserved through VB updates, 
thus this screen will be displayed again at that time."));
++      msgBox.exec();
 +        app.quit();
-+        return 0;
++      if (msgBox.clickedButton() == myYesButton)
++              return 0;
++        return 1;
 +}
 +

++++++ vbox-vboxadd-init-script.diff ++++++
--- /var/tmp/diff_new_pack.SV6b24/_old  2017-07-04 11:54:08.985208863 +0200
+++ /var/tmp/diff_new_pack.SV6b24/_new  2017-07-04 11:54:08.989208300 +0200
@@ -16,7 +16,7 @@
  ### END INIT INFO
  
  ## @todo This file duplicates a lot of script with vboxdrv.sh.  When making
-@@ -108,7 +111,6 @@ fail()
+@@ -108,11 +111,10 @@ fail()
  
  dev=/dev/vboxguest
  userdev=/dev/vboxuser
@@ -24,6 +24,11 @@
  owner=vboxadd
  group=1
  
+-if test -r $config; then
++if [[ -r $config ]] ; then
+   . $config
+ else
+   fail "Configuration file $config not found"
 @@ -162,12 +164,6 @@ do_vboxguest_non_udev()
              fail "Cannot create device $dev with major $maj and minor $min"
          }

++++++ vbox_fix_for_gcc7.patch ++++++
--- /var/tmp/diff_new_pack.SV6b24/_old  2017-07-04 11:54:09.009205486 +0200
+++ /var/tmp/diff_new_pack.SV6b24/_new  2017-07-04 11:54:09.009205486 +0200
@@ -25,3 +25,251 @@
  }
  
  /* PXENV_START_UNDI
+Index: 
VirtualBox-5.1.22/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest
+===================================================================
+--- 
VirtualBox-5.1.22.orig/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest
++++ VirtualBox-5.1.22/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest
+@@ -54,6 +54,7 @@ FILES_VBOXGUEST_NOBIN=" \
+     ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
+     ${PATH_ROOT}/include/iprt/timer.h=>include/iprt/timer.h \
+     ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
++    ${PATH_ROOT}/include/iprt/uint64.h=>include/iprt/uint64.h \
+     ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
+     ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \
+     ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \
+@@ -113,6 +114,7 @@ FILES_VBOXGUEST_NOBIN=" \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/qdivrem.c=>common/math/gcc/qdivrem.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/quad.h=>common/math/gcc/quad.h \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivdi3.c=>common/math/gcc/udivdi3.c
 \
++    
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivmoddi4.c=>common/math/gcc/udivmoddi4.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/umoddi3.c=>common/math/gcc/umoddi3.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp=>common/misc/RTAssertMsg1Weak.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp=>common/misc/RTAssertMsg2.c
 \
+Index: VirtualBox-5.1.22/src/VBox/Additions/common/VBoxGuest/linux/Makefile
+===================================================================
+--- VirtualBox-5.1.22.orig/src/VBox/Additions/common/VBoxGuest/linux/Makefile
++++ VirtualBox-5.1.22/src/VBox/Additions/common/VBoxGuest/linux/Makefile
+@@ -100,6 +100,7 @@ MOD_OBJS += \
+       common/math/gcc/divdi3.o \
+       common/math/gcc/moddi3.o \
+       common/math/gcc/udivdi3.o \
++      common/math/gcc/udivmoddi4.o \
+       common/math/gcc/umoddi3.o \
+       common/math/gcc/qdivrem.o
+ endif
+Index: VirtualBox-5.1.22/src/VBox/Additions/linux/sharedfolders/files_vboxsf
+===================================================================
+--- VirtualBox-5.1.22.orig/src/VBox/Additions/linux/sharedfolders/files_vboxsf
++++ VirtualBox-5.1.22/src/VBox/Additions/linux/sharedfolders/files_vboxsf
+@@ -38,6 +38,7 @@ FILES_VBOXSF_NOBIN=" \
+     ${PATH_ROOT}/include/iprt/string.h=>include/iprt/string.h \
+     ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
+     ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
++    ${PATH_ROOT}/include/iprt/uint64.h=>include/iprt/uint64.h \
+     ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
+     ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \
+     ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \
+@@ -73,6 +74,7 @@ FILES_VBOXSF_NOBIN=" \
+     ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/qdivrem.c=>qdivrem.c \
+     ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/quad.h=>quad.h \
+     ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivdi3.c=>udivdi3.c \
++    ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivmoddi4.c=>udivmoddi4.c \
+     ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/umoddi3.c=>umoddi3.c \
+     
${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h=>r0drv/linux/the-linux-kernel.h
 \
+     
${PATH_ROOT}/src/VBox/Additions/linux/sharedfolders/Makefile.module=>Makefile \
+Index: VirtualBox-5.1.22/src/VBox/Additions/linux/sharedfolders/Makefile.module
+===================================================================
+--- 
VirtualBox-5.1.22.orig/src/VBox/Additions/linux/sharedfolders/Makefile.module
++++ VirtualBox-5.1.22/src/VBox/Additions/linux/sharedfolders/Makefile.module
+@@ -38,6 +38,7 @@ MOD_OBJS  += \
+       divdi3.o \
+       moddi3.o \
+       udivdi3.o \
++      udivmoddi4.o \
+       umoddi3.o \
+       qdivrem.o
+ endif
+Index: VirtualBox-5.1.22/src/VBox/HostDrivers/Support/linux/files_vboxdrv
+===================================================================
+--- VirtualBox-5.1.22.orig/src/VBox/HostDrivers/Support/linux/files_vboxdrv
++++ VirtualBox-5.1.22/src/VBox/HostDrivers/Support/linux/files_vboxdrv
+@@ -65,6 +65,7 @@ FILES_VBOXDRV_NOBIN=" \
+     ${PATH_ROOT}/include/iprt/timer.h=>include/iprt/timer.h \
+     ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
+     ${PATH_ROOT}/include/iprt/uint128.h=>include/iprt/uint128.h \
++    ${PATH_ROOT}/include/iprt/uint64.h=>include/iprt/uint64.h \
+     ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
+     ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \
+     ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \
+@@ -109,6 +110,7 @@ FILES_VBOXDRV_NOBIN=" \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/qdivrem.c=>math/gcc/qdivrem.c \
+     ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/quad.h=>math/gcc/quad.h \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivdi3.c=>math/gcc/udivdi3.c \
++    
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivmoddi4.c=>math/gcc/udivmoddi4.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/umoddi3.c=>math/gcc/umoddi3.c \
+     
${PATH_ROOT}/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp=>common/misc/RTAssertMsg1Weak.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp=>common/misc/RTAssertMsg2.c
 \
+Index: VirtualBox-5.1.22/src/VBox/HostDrivers/Support/linux/Makefile
+===================================================================
+--- VirtualBox-5.1.22.orig/src/VBox/HostDrivers/Support/linux/Makefile
++++ VirtualBox-5.1.22/src/VBox/HostDrivers/Support/linux/Makefile
+@@ -158,6 +158,7 @@ OBJS += math/gcc/divdi3.o \
+       math/gcc/moddi3.o \
+       math/gcc/qdivrem.o \
+       math/gcc/udivdi3.o \
++      math/gcc/udivmoddi4.o \
+       math/gcc/divdi3.o \
+       math/gcc/umoddi3.o
+ endif
+Index: VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp
+===================================================================
+--- 
VirtualBox-5.1.22.orig/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp
++++ VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp
+@@ -49,6 +49,7 @@ VBOX_VBOXNETADP_SOURCES=" \
+     ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
+     ${PATH_ROOT}/include/iprt/timer.h=>include/iprt/timer.h \
+     ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
++    ${PATH_ROOT}/include/iprt/uint64.h=>include/iprt/uint64.h \
+     ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
+     ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \
+     ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \
+@@ -70,6 +71,7 @@ VBOX_VBOXNETADP_SOURCES=" \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/qdivrem.c=>math/gcc/qdivrem.c \
+     ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/quad.h=>math/gcc/quad.h \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivdi3.c=>math/gcc/udivdi3.c \
++    
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivmoddi4.c=>math/gcc/udivmoddi4.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/umoddi3.c=>math/gcc/umoddi3.c \
+     
${PATH_ROOT}/src/VBox/Runtime/common/string/strformat.cpp=>common/string/strformat.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/string/strformatrt.cpp=>common/string/strformatrt.c
 \
+Index: VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxNetAdp/linux/Makefile
+===================================================================
+--- VirtualBox-5.1.22.orig/src/VBox/HostDrivers/VBoxNetAdp/linux/Makefile
++++ VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxNetAdp/linux/Makefile
+@@ -68,6 +68,7 @@ OBJS += math/gcc/divdi3.o \
+       math/gcc/moddi3.o \
+       math/gcc/qdivrem.o \
+       math/gcc/udivdi3.o \
++      math/gcc/udivmoddi4.o \
+         math/gcc/divdi3.o \
+       math/gcc/umoddi3.o
+ endif
+Index: VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxNetFlt/linux/files_vboxnetflt
+===================================================================
+--- 
VirtualBox-5.1.22.orig/src/VBox/HostDrivers/VBoxNetFlt/linux/files_vboxnetflt
++++ VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxNetFlt/linux/files_vboxnetflt
+@@ -49,6 +49,7 @@ VBOX_VBOXNETFLT_SOURCES=" \
+     ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
+     ${PATH_ROOT}/include/iprt/timer.h=>include/iprt/timer.h \
+     ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
++    ${PATH_ROOT}/include/iprt/uint64.h=>include/iprt/uint64.h \
+     ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
+     ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \
+     ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \
+@@ -77,6 +78,7 @@ VBOX_VBOXNETFLT_SOURCES=" \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/qdivrem.c=>math/gcc/qdivrem.c \
+     ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/quad.h=>math/gcc/quad.h \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivdi3.c=>math/gcc/udivdi3.c \
++    
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivmoddi4.c=>math/gcc/udivmoddi4.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/umoddi3.c=>math/gcc/umoddi3.c \
+     
${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h=>r0drv/linux/the-linux-kernel.h
 \
+     ${PATH_OUT}/version-generated.h=>version-generated.h \
+Index: VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxNetFlt/linux/Makefile
+===================================================================
+--- VirtualBox-5.1.22.orig/src/VBox/HostDrivers/VBoxNetFlt/linux/Makefile
++++ VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxNetFlt/linux/Makefile
+@@ -72,6 +72,7 @@ OBJS += math/gcc/divdi3.o \
+       math/gcc/moddi3.o \
+       math/gcc/qdivrem.o \
+       math/gcc/udivdi3.o \
++      math/gcc/udivmoddi4.o \
+         math/gcc/divdi3.o \
+       math/gcc/umoddi3.o
+ endif
+Index: VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxPci/linux/files_vboxpci
+===================================================================
+--- VirtualBox-5.1.22.orig/src/VBox/HostDrivers/VBoxPci/linux/files_vboxpci
++++ VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxPci/linux/files_vboxpci
+@@ -48,6 +48,7 @@ VBOX_VBOXPCI_SOURCES=" \
+     ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
+     ${PATH_ROOT}/include/iprt/timer.h=>include/iprt/timer.h \
+     ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
++    ${PATH_ROOT}/include/iprt/uint64.h=>include/iprt/uint64.h \
+     ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
+     ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \
+     ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \
+@@ -75,6 +76,7 @@ VBOX_VBOXPCI_SOURCES=" \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/qdivrem.c=>math/gcc/qdivrem.c \
+     ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/quad.h=>math/gcc/quad.h \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivdi3.c=>math/gcc/udivdi3.c \
++    
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/udivmoddi4.c=>math/gcc/udivmoddi4.c
 \
+     
${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/umoddi3.c=>math/gcc/umoddi3.c \
+     
${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h=>r0drv/linux/the-linux-kernel.h
 \
+     ${PATH_OUT}/version-generated.h=>version-generated.h \
+Index: VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxPci/linux/Makefile
+===================================================================
+--- VirtualBox-5.1.22.orig/src/VBox/HostDrivers/VBoxPci/linux/Makefile
++++ VirtualBox-5.1.22/src/VBox/HostDrivers/VBoxPci/linux/Makefile
+@@ -72,6 +72,7 @@ OBJS += math/gcc/divdi3.o       \
+       math/gcc/moddi3.o       \
+       math/gcc/qdivrem.o      \
+       math/gcc/udivdi3.o      \
++      math/gcc/udivmoddi4.o   \
+         math/gcc/divdi3.o     \
+       math/gcc/umoddi3.o
+ endif
+Index: VirtualBox-5.1.22/src/VBox/Runtime/common/math/gcc/udivmoddi4.c
+===================================================================
+--- /dev/null
++++ VirtualBox-5.1.22/src/VBox/Runtime/common/math/gcc/udivmoddi4.c
+@@ -0,0 +1,51 @@
++/* $Id$ */
++/** @file
++ * IPRT - __udivmoddi4 implementation
++ */
++
++/*
++ * Copyright (C) 2006-2016 Oracle Corporation
++ *
++ * This file is part of VirtualBox Open Source Edition (OSE), as
++ * available from http://www.virtualbox.org. This file is free software;
++ * you can redistribute it and/or modify it under the terms of the GNU
++ * General Public License (GPL) as published by the Free Software
++ * Foundation, in version 2 as it comes in the "COPYING" file of the
++ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
++ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
++ *
++ * The contents of this file may alternatively be used under the terms
++ * of the Common Development and Distribution License Version 1.0
++ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
++ * VirtualBox OSE distribution, in which case the provisions of the
++ * CDDL are applicable instead of those of the GPL.
++ *
++ * You may elect to license modified versions of this file under the
++ * terms and conditions of either the GPL or the CDDL or both.
++ */
++
++#include <iprt/stdint.h>
++#include <iprt/uint64.h>
++
++/**
++ * __udivmoddi4() implementation to satisfy external references from 32-bit
++ * code generated by gcc-7 or later.
++ *
++ * @param   u64A        The divident value.
++ * @param   u64B        The divisor value.
++ * @param   pu64R       A pointer to the reminder. May be NULL.
++ * @returns u64A / u64B
++ */
++uint64_t __udivmoddi4(uint64_t u64A, uint64_t u64B, uint64_t *pu64R)
++{
++    RTUINT64U Divident;
++    RTUINT64U Divisor;
++    RTUINT64U Quotient;
++    RTUINT64U Reminder;
++    Divident.u = u64A;
++    Divisor.u  = u64B;
++    RTUInt64DivRem(&Quotient, &Reminder, &Divident, &Divisor);
++    if (pu64R)
++        *pu64R = Reminder.u;
++    return Quotient.u;
++}

++++++ vbox_fix_for_kernel_4.12.patch ++++++
Index: VirtualBox-5.1.22/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
===================================================================
--- VirtualBox-5.1.22.orig/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
+++ VirtualBox-5.1.22/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
@@ -1397,7 +1397,7 @@ RTDECL(int) SUPR0Printf(const char *pszF
 SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void)
 {
     uint32_t fFlags = 0;
-#ifdef CONFIG_PAX_KERNEXEC
+#if defined(CONFIG_PAX_KERNEXEC) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 
12, 0)
     fFlags |= SUPKERNELFEATURES_GDT_READ_ONLY;
 #endif
 #if defined(VBOX_STRICT) || defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV)
Index: VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
===================================================================
--- VirtualBox-5.1.22.orig/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
+++ VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
@@ -36,6 +36,9 @@
 #include <iprt/err.h>
 #include "r0drv/alloc-r0drv.h"
 #include <linux/kmemleak.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+#include <asm/set_memory.h>
+#endif
 
 #if (defined(RT_ARCH_AMD64) || defined(DOXYGEN_RUNNING)) && 
!defined(RTMEMALLOC_EXEC_HEAP)
 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
Index: VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
===================================================================
--- VirtualBox-5.1.22.orig/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+++ VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
@@ -899,6 +899,9 @@ static struct page *rtR0MemObjLinuxVirtT
     unsigned long   pfn;
     struct page    *pPage;
     pte_t          *pEntry;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+    p4d_t          p4d;
+#endif
     union
     {
         pgd_t       Global;
@@ -917,9 +920,18 @@ static struct page *rtR0MemObjLinuxVirtT
     u.Global = *pgd_offset(current->active_mm, ulAddr);
     if (RT_UNLIKELY(pgd_none(u.Global)))
         return NULL;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+    p4d = *p4d_offset(&u.Global, ulAddr);
+    if (RT_UNLIKELY(p4d_none(p4d) || p4d_large(p4d) || !p4d_present(p4d)))
+        return NULL;
+#endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+    u.Upper = *pud_offset(&p4d, ulAddr);
+#else
     u.Upper = *pud_offset(&u.Global, ulAddr);
+#endif
     if (RT_UNLIKELY(pud_none(u.Upper)))
         return NULL;
 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
@@ -1463,13 +1475,23 @@ static int rtR0MemObjLinuxFixPte(struct
 {
     int rc = -ENOMEM;
     pgd_t *pgd;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+    p4d_t *p4d;
+#endif
 
     spin_lock(&mm->page_table_lock);
 
     pgd = pgd_offset(mm, ulAddr);
     if (!pgd_none(*pgd) && !pgd_bad(*pgd))
     {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+       p4d = p4d_offset(*pgd, ulAddr);
+       if (p4d_none(*p4d))
+           goto exit;
+       pmd_t *pmd = pmd_offset(p4d, ulAddr);
+#else
         pmd_t *pmd = pmd_offset(pgd, ulAddr);
+#endif
         if (!pmd_none(*pmd))
         {
             pte_t *ptep = pte_offset_map(pmd, ulAddr);
@@ -1487,6 +1509,9 @@ static int rtR0MemObjLinuxFixPte(struct
         }
     }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+exit:
+#endif
     spin_unlock(&mm->page_table_lock);
     return rc;
 }
Index: VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
===================================================================
--- VirtualBox-5.1.22.orig/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
+++ VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
@@ -320,6 +320,9 @@ DECLINLINE(unsigned long) msecs_to_jiffi
 #endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+#include <asm/cacheflush.h>
+#endif
 # define MY_SET_PAGES_EXEC(pPages, cPages)    set_pages_x(pPages, cPages)
 # define MY_SET_PAGES_NOEXEC(pPages, cPages)  set_pages_nx(pPages, cPages)
 #else
++++++ vboxconfig.sh ++++++
--- /var/tmp/diff_new_pack.SV6b24/_old  2017-07-04 11:54:09.061198170 +0200
+++ /var/tmp/diff_new_pack.SV6b24/_new  2017-07-04 11:54:09.061198170 +0200
@@ -5,15 +5,22 @@
 #
 # This script is part of the openSUSE VirtualBox package
 #
-SOURCE="/usr/src/kernel-modules/virtualbox"
+SOURCE="/usr/src/kernel-modules/virtualbox/src"
 LOGFILE="/var/log/virtualbox.log"
 INCLUDE="/lib/modules/`uname -r`/build/include"
-
+#
+# Test if vboxpci module loaded. If it is, skip everything else
+loaded=$(lsmod | grep vboxpci)
+if [ -n "$loaded" ] ; then
+       echo "Kernel modules available - exiting..."
+       exit 0
+fi
+#
 # Force installation of VB host sources. Zypper will install all the 
prerequisies
 echo "Installing all required packages..."
 killproc PackageKit
 zypper install -y virtualbox-host-source > /dev/null 2>&1
-if [ ! $? ] ; then
+if [ "$?" -ne 0 ] ; then
        echo "Installation of required packages failed."
        echo "Use 'sudo zypper install virtualbox-host-source' to see the 
reason."
        exit 1
@@ -22,7 +29,7 @@
 pushd $SOURCE > /dev/null 2>&1
 echo "Building kernel modules..."
 make > $LOGFILE 2>&1
-if [ ! $? ] ; then
+if [ "$?" -ne 0 ] ; then
        echo ""
        echo "Build of VirtualBox host kernel modules failed."
        echo "Look at $LOGFILE to find reasons."
@@ -32,7 +39,7 @@
 echo "Kernel modules built correctly. They will now be installed."
 fi
 make install >> $LOGFILE 2>&1
-if [ ! $? ] ; then
+if [ "$?" -ne 0 ] ; then
        echo ""
        echo "Installation of VirtualBox host kernel modules failed."
        echo "Look at $LOGFILE to find reasons."

++++++ vboxguestconfig.sh ++++++
--- /var/tmp/diff_new_pack.SV6b24/_old  2017-07-04 11:54:09.093193667 +0200
+++ /var/tmp/diff_new_pack.SV6b24/_new  2017-07-04 11:54:09.093193667 +0200
@@ -5,15 +5,21 @@
 #
 # This script is part of the openSUSE VirtualBox package
 #
-SOURCE="/usr/src/kernel-modules/virtualbox"
+SOURCE="/usr/src/kernel-modules"
 LOGFILE="/var/log/virtualbox.log"
 INCLUDE="/lib/modules/`uname -r`/build/include"
-
+#
+# Test if vboxsf module loaded. If it is, skip everything else
+loaded=$(lsmod | grep vboxsf)
+if [ -n "$loaded" ] ; then
+       echo "Kernel modules available - exiting..."
+       exit 0
+fi
 # Force installation of VB guest sources. Zypper will install all the 
prerequisies
 echo "Installing all required packages..."
 killproc PackageKit
 zypper install -y virtualbox-guest-source > /dev/null 2>&1
-if [ ! $? ] ; then
+if [ "$?" -ne 0 ] ; then
        echo "Installation of required packages failed."
        echo "Use 'sudo zypper install virtualbox-guest-source' to see the 
reason."
        exit 1
@@ -21,10 +27,10 @@
 # Prerequisites are available, start build
 pushd $SOURCE > /dev/null 2>&1
 echo "Building kernel modules..."
-tar jxf guest_src.tar.bz2 > /dev/null 2>&1
+tar jxf addition/guest_src.tar.bz2 > /dev/null 2>&1
 cd additions/src
 make > $LOGFILE 2>&1
-if [ ! $? ] ; then
+if [ "$?" -ne 0 ] ; then
        echo ""
        echo "Build of VirtualBox guest kernel modules failed."
        echo "Look at $LOGFILE to find reasons."
@@ -34,7 +40,7 @@
 echo "Kernel modules built correctly. They will now be installed."
 fi
 make install >> $LOGFILE 2>&1
-if [ ! $? ] ; then
+if [ "$?" -ne 0 ] ; then
        echo ""
        echo "Installation of VirtualBox guest kernel modules failed."
        echo "Look at $LOGFILE to find reasons."


++++++ virtualbox-wrapper.sh ++++++
--- /var/tmp/diff_new_pack.SV6b24/_old  2017-07-04 11:54:09.253171154 +0200
+++ /var/tmp/diff_new_pack.SV6b24/_new  2017-07-04 11:54:09.253171154 +0200
@@ -1,9 +1,58 @@
 #!/bin/bash
 export QT_NO_KDE_INTEGRATION=1
+# make certain that the user/group combination is valid
 /usr/bin/id -nG | grep -v -e "root" -e "vboxusers" >/dev/null && 
/usr/lib/virtualbox/VBoxPermissionMessage && exit
-if [ ! -f ~/.vbox/message_out ] ; then
+#
+# Handle the issue regarding USB passthru
+# The following conditions apply:
+# 1. If ~/.vbox/enable exists, the user accepts the security risk.
+# 2. If ~/.vbox/disable exists, the user does not accept the risk. That file 
will contain the inode of /etc/udev/rules.d/60-vboxdrv.rules.
+#    When that changes, the VBoxUSB_DevRules will again be displayed as that 
means that VB has been reloaded. 
+#
+devrules()
+{
     /usr/lib/virtualbox/VBoxUSB_DevRules
-    mkdir -p ~/.vbox/
-    touch ~/.vbox/message_out
+    if [ $? -eq 0 ] ; then
+       # User accepts the risk
+       touch ~/.vbox/enable
+       rm -f ~/.vbox/disable
+    else
+       # User declines the risk - save the inode
+       echo "" > ~/.vbox/disable
+       rm -f ~/.vbox/enable
+    fi
+}
+# Start of main routine
+#
+# Ensure that ~/.vbox exists
+mkdir -p ~/.vbox/
+# Get the inode for /etc/udev/rules.d/60-vboxdrv.rules
+INODE=$(stat /etc/udev/rules.d/60-vboxdrv.rules | grep Inode | cut -d' ' -f3)
+if [ ! -f ~/.vbox/enable ] && [ ! -f ~/.vbox/disable ] ; then
+       # Neither file exists - find what the user wants
+       devrules
 fi
+# Get the original Inode if it exists
+if [ -f ~/.vbox/disable ] ; then
+    read LINE < ~/.vbox/disable
+else
+    LINE=" "
+fi
+# If user originally declined, make certain that 
/etc/udev/rules.d/60-vboxdrv.rules has not been changed
+if [ -f ~/.vbox/disable ] && [ "$LINE" != "$INODE" ] && [ "$LINE" != "" ] ; 
then
+    # disable is selected and the Inode has changed - ask again
+    devrules
+fi
+if [ -f ~/.vbox/disable ] ; then
+    echo $INODE > ~/.vbox/disable
+    if [ "$LINE" != "$INODE" ] ; then
+       if [ -f /usr/bin/kdesu ] ; then
+           kdesu /sbin/vbox-fix-usb-rules.sh
+       fi
+       if [ -f /usr/bin/gnomesu ] ; then
+           gnomesu /sbin/vbox-fix-usb-rules.sh
+       fi
+    fi
+fi
+# Now run the VB GUI
 LD_LIBRARY_PATH="/usr/lib/virtualbox${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" 
/usr/lib/virtualbox/VirtualBox $@


Reply via email to