forked from pool/virtualbox
806003d2a3
- Addresses VUL-0: CVE-2017-10392,CVE-2017-10407,CVE-2017-10408,CVE-2017-3733,CVE-2017-10428 as noted in bsc #1064200 - Fix /sbin/vboxguestconfig.sh to be similar to /sbin/vboxconfig.sh. OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=380
64 lines
1.9 KiB
Bash
64 lines
1.9 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Script to build VirtualBox guest kernel modules
|
|
# Copyright C 2017 by Larry Finger
|
|
#
|
|
# This script is part of the openSUSE VirtualBox package
|
|
#
|
|
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
|
|
#
|
|
# Check if virtualbox-guest-source is installed, quit if not
|
|
if ! rpm -qf "$SOURCE/virtualbox/src/Makefile" &>/dev/null ; then
|
|
echo "Sources for building guest modules are not present,"
|
|
echo "Use 'sudo zypper install virtualbox-guest-source' to install them. Quitting .."
|
|
exit 1
|
|
fi
|
|
#
|
|
# Check if virtualbox-guest-source version matches virtualbox version
|
|
if [ "$(rpm -q virtualbox virtualbox-guest-source --queryformat='%{version}-%{release}\n' 2>/dev/null | sort -u | wc -l)" -ne "1" ] ; then
|
|
echo "virtualbox-guest-source package version doesn't match"
|
|
echo "the version of virtualbox package."
|
|
echo "Reinstall virtualbox-guest-source package. Quitting .."
|
|
exit 1
|
|
fi
|
|
# Prerequisites are available, start build
|
|
pushd $SOURCE > /dev/null 2>&1
|
|
echo "Building kernel modules..."
|
|
tar jxf addition/guest_src.tar.bz2 > /dev/null 2>&1
|
|
cd additions/src
|
|
make > $LOGFILE 2>&1
|
|
if [ "$?" -ne 0 ] ; then
|
|
echo ""
|
|
echo "Build of VirtualBox guest kernel modules failed."
|
|
echo "Look at $LOGFILE to find reasons."
|
|
popd > /dev/null 2>&1
|
|
exit 1
|
|
else
|
|
echo "Kernel modules built correctly. They will now be installed."
|
|
fi
|
|
make install >> $LOGFILE 2>&1
|
|
if [ "$?" -ne 0 ] ; then
|
|
echo ""
|
|
echo "Installation of VirtualBox guest kernel modules failed."
|
|
echo "Look at $LOGFILE to find reasons."
|
|
popd > /dev/null 2>&1
|
|
exit 1
|
|
fi
|
|
depmod -a
|
|
modprobe -av vboxguest vboxvideo vboxsf
|
|
cd ../..
|
|
rm -rf additions
|
|
popd > /dev/null 2>&1
|
|
echo "Kernel modules are installed and loaded."
|
|
exit 0
|
|
|