#!/bin/bash # # virtualbox-host-modules.SlackBuild is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the License, # or any later version. # # virtualbox-host-modules.SlackBuild is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # Copyright 2008-2010 Heinz Wiesinger, Amsterdam, The Netherlands # Copyright 2008 Mauro Giachero # Copyright 2012 Michiel Broek, The Netherlands # default settings PACKAGE="virtualbox-host-modules" PACKAGE_EXT="gz" VERSION=${VERSION:=5.0.40} BUILD=${BUILD:=1} KERNEL=${KERNEL:-$(uname -r)} KERNELPATH=${KERNELPATH:-/lib/modules/$KERNEL/build} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi PVERSION=${PVERSION}_$(echo ${KERNEL} | tr '-' '_') SRC=../virtualbox/virtualbox-kernel-${VERSION}.tar.gz if [ ! -f $SRC ]; then echo "First build the virtualbox-host package, that will create the" echo "source for the kernel modules." exit 1 fi unpack_source $SRC virtualbox-kernel-${VERSION} # Build kernel modules make KERN_DIR=${KERNELPATH} mkdir -p $PKG/lib/modules/$KERNEL/misc install -m 0644 vboxdrv.ko $PKG/lib/modules/$KERNEL/misc/ install -m 0644 vboxnetflt.ko $PKG/lib/modules/$KERNEL/misc/ install -m 0644 vboxnetadp.ko $PKG/lib/modules/$KERNEL/misc/ install -m 0644 vboxpci.ko $PKG/lib/modules/$KERNEL/misc/ mkdir -p $PKG/install echo "chroot . /sbin/depmod -a $KERNEL" > $PKG/install/doinst.sh fixup_package $PKG # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi