From f3820cb7d9018221d40764bdd4c75feaaeb043a4c9afa2d5be7c2e54a48e9fdc Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sun, 25 Jun 2017 17:11:33 +0000 Subject: [PATCH] - Fix logic error in scripts to build kernel modules locally - see bnc#1042726. Temporarily remove "requires" for net-tools-deprecated so that Leap 42.3 will build. OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=341 --- vboxconfig.sh | 17 ++++++++++++----- vboxguestconfig.sh | 18 ++++++++++++------ virtualbox.changes | 6 ++++++ virtualbox.spec | 6 +++--- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/vboxconfig.sh b/vboxconfig.sh index 1cd5d4c..5f3ebe5 100644 --- a/vboxconfig.sh +++ b/vboxconfig.sh @@ -1,4 +1,4 @@ -#!/bin/bash +!/bin/bash # # Script to build VirtualBox host kernel modules # Copyright C 2017 by Larry Finger @@ -8,12 +8,19 @@ 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 @@ fi 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 @@ else 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." diff --git a/vboxguestconfig.sh b/vboxguestconfig.sh index ba789c3..299a080 100644 --- a/vboxguestconfig.sh +++ b/vboxguestconfig.sh @@ -8,12 +8,18 @@ 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 @@ fi # Prerequisites are available, start build pushd $SOURCE > /dev/null 2>&1 echo "Building kernel modules..." -tar jxf additions/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 @@ else 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." @@ -44,7 +50,7 @@ fi depmod -a modprobe -av vboxguest vboxvideo vboxsf cd ../.. -rm -rf additions/src +rm -rf additions popd > /dev/null 2>&1 echo "Kernel modules are installed and loaded." exit 0 diff --git a/virtualbox.changes b/virtualbox.changes index a74fa5d..ec47f1d 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Jun 25 17:09:01 UTC 2017 - Larry.Finger@lwfinger.net + +- Fix logic error in scripts to build kernel modules locally - see bnc#1042726. + Temporarily remove "requires" for net-tools-deprecated so that Leap 42.3 will build. + ------------------------------------------------------------------- Sun Jun 25 00:20:08 UTC 2017 - Larry.Finger@lwfinger.net diff --git a/virtualbox.spec b/virtualbox.spec index 72ea665..ec5e4f0 100644 --- a/virtualbox.spec +++ b/virtualbox.spec @@ -175,9 +175,9 @@ BuildRequires: pkgconfig(xrandr) Requires: %{name}-host-kmp = %{version} Requires(post): sysvinit(syslog) Requires(pre): permissions -%if ! 0%{?suse_version} > 1325 -Requires(pre): net-tools-deprecated -%endif +#%if ! 0%{?suse_version} > 1325 +#Requires(pre): net-tools-deprecated +#%endif Requires(pre): pwdutils Requires(pre): %insserv_prereq Requires(pre): %fillup_prereq