[VirtualBox] Use systemd-detect-virt to detect if we can install

Sérgio M. Basto sergiomb at rpmfusion.org
Mon Nov 28 22:35:42 CET 2016


commit 738bad03ff3a651a54b9225098f8b89399fee446
Author: Sérgio M. Basto <sergio at serjux.com>
Date:   Mon Nov 28 21:34:31 2016 +0000

    Use systemd-detect-virt to detect if we can install
    
      VirtualBox-guest-additions, which fix an old problem which made not possible
      install VirtualBox in a guest machine.
      Removed conflicts between main package and guest-additions.

 VirtualBox.spec | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/VirtualBox.spec b/VirtualBox.spec
index ac99fa9..a37062f 100644
--- a/VirtualBox.spec
+++ b/VirtualBox.spec
@@ -25,7 +25,7 @@
 Name:       VirtualBox
 Version:    5.1.10
 #Release:   1%%{?prerel:.%%{prerel}}%%{?dist}
-Release:    1%{?dist}
+Release:    2%{?dist}
 Summary:    A general-purpose full virtualizer for PC hardware
 
 License:    GPLv2 or (GPLv2 and CDDL)
@@ -158,8 +158,6 @@ Summary:    core part (host server) for %{name}
 Group:      Development/Tools
 Requires:   %{name}-kmod = %{version}
 Provides:   %{name}-kmod-common = %{version}-%{release}
-Conflicts:  %{name}-guest <= %{version}-%{release}
-Conflicts:  %{name}-guest-additions <= %{version}-%{release}
 
 %description server
 %{name} without Qt GUI part.
@@ -208,7 +206,6 @@ Requires:   %(xserver-sdk-abi-requires ansic)
 Requires:   %(xserver-sdk-abi-requires videodrv)
 Requires:   %(xserver-sdk-abi-requires xinput)
 %endif
-Conflicts:  %{name} <= %{version}-%{release}
 
 
 %description guest-additions
@@ -610,6 +607,13 @@ fi
 /usr/bin/update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
 
 %pre guest-additions
+if [ $(systemd-detect-virt | grep -iP "oracle|kvm" -c) -eq 0 ]; then
+echo "This package it is only to install in one Oracle VM VirtualBox."
+echo "You are trying install VirtualBox guest-additions but it hasn't been \
+detected that your system is running in a VirtualBox virtualization, so we \
+forced the installation to fail."
+exit 1
+fi
 # This is the LSB version of useradd and should work on recent
 # distributions
 getent passwd vboxadd >/dev/null || useradd -d /var/run/vboxadd -g 1 -r -s /bin/false vboxadd 2>&1
@@ -760,6 +764,12 @@ getent group vboxsf >/dev/null || groupadd -r vboxsf 2>&1
 %{_datadir}/%{name}-kmod-%{version}
 
 %changelog
+* Mon Nov 28 2016 Sérgio Basto <sergio at serjux.com> - 5.1.10-2
+- Use systemd-detect-virt to detect if we can install
+  VirtualBox-guest-additions, which fix an old problem which made not possible
+  install VirtualBox in a guest machine.
+  Removed conflicts between main package and guest-additions.
+
 * Tue Nov 22 2016 Sérgio Basto <sergio at serjux.com> - 5.1.10-1
 - New upstream release, 5.1.10
 


More information about the rpmfusion-commits mailing list