description="Virtualbox Host modules for the latest stable Linux Kernel version"
url="http://www.virtualbox.org"

packager="spiky <spiky@nutyx.org>"
contributors="Tnut"

run=(kernel)
name=vboxhost-6-kernel
version=6.1.48

buildr=159471
_VBARCH=amd64
source=(http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}-${buildr}-Linux_${_VBARCH}.run)

build(){

KERNEL_VERSION="$(basename /lib/modules/*)"

sh VirtualBox-${version}-${buildr}-Linux_${_VBARCH}.run --target vb --keep --noexec
cd vb
tar xfj VirtualBox.tar.bz2
cd src/vboxhost

sed -i "s/netif_rx_ni/netif_rx/" vboxnetflt/linux/VBoxNetFlt-linux.c

KERN_VER=${KERNEL_VERSION} make

for i in *.ko
do
	install -D -m0644 $i \
	$PKG/lib/modules/${KERNEL_VERSION}/kernel/drivers/virt/vboxhost/$i
done

echo "depmod -a ${KERNEL_VERSION}" > $PKGMK_ROOT/$name.post-install
}
