aboutsummaryrefslogtreecommitdiffstats
path: root/testing/virtualbox-guest-modules-grsec/APKBUILD
blob: c4cb46800759fe883f560291c42eb2a904bfc677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Maintainer: Ben Allen <bensallen@me.com>
# Contributor: Ben Allen <bensallen@me.com>

_flavor=${FLAVOR:-grsec}
_kpkg=linux-$_flavor
_kver=4.4.27
_kpkgrel=0

# when chaning _ver we *must* bump _mypkgrel
_ver=5.1.6
_mypkgrel=0
_name=virtualbox-guest-modules

# verify the kernel version before entering chroot
_kapkbuild=../../linux-${_flavor}/APKBUILD
if [ -f $_kapkbuild ]; then
	. $_kapkbuild
	pkgname=$_name-$_flavor
	[ "$_kver" != "$pkgver" ] && die "please update _kver to $pkgver"
	[ "$_kpkgrel" != "$pkgrel" ] && die "please update _kpkgrel to $pkgrel"
fi

_kpkgver="$_kver-r$_kpkgrel"
_abi_release=${_kver}-${_kpkgrel}-${_flavor}
_abi_release_virtgrsec=${_kver}-${_kpkgrel}-virtgrsec

pkgname=${_name}-${_flavor}
pkgver=$_kver
pkgrel=$(($_kpkgrel + $_mypkgrel))
pkgdesc="VirtualBox Additions kernel modules for $_flavor "
arch='x86 x86_64'
url='http://virtualbox.org'
license="GPL custom"
makedepends="linux-grsec-dev=$_kpkgver sed coreutils"
subpackages="$_name-virtgrsec:_virtgrsec"
source="http://download.virtualbox.org/virtualbox/$_ver/VirtualBox-$_ver.tar.bz2
"
builddir="$srcdir"/VirtualBox-$_ver

prepare() {
	local i
	cd "$builddir"
	$builddir/src/VBox/Additions/linux/export_modules "$builddir/vbox-kmod.tar.gz"
	tar -xf "$builddir/vbox-kmod.tar.gz"
	for i in $_abi_release $_abi_release_virtgrsec; do
		mkdir -p "$srcdir/$i"
		tar -C "$srcdir/$i" -zxf "$builddir"/vbox-kmod.tar.gz
	done
}

build() {
	local i
	for i in $_abi_release $_abi_release_virtgrsec; do
		cd "$srcdir/$i"
		# Build Kernel Modules
		make KERN_DIR=/lib/modules/${_abi_release}/build \
			KCFLAGS="-fno-pie" || return 1
	done
}

package() {
	local i module=
	for i in $_abi_release $_abi_release_virtgrsec; do
		cd "$srcdir/$i"
		for module in *.ko; do
			install -v -D -m644 ${module} \
				"$pkgdir/lib/modules/$i/misc/${module}"
		done
	done
}

_virtgrsec() {
	pkgdesc="VirtualBox Additions kernel modules for virtgrsec"
	mkdir -p "$subpkgdir"/lib/modules/
	mv "$pkgdir"/lib/modules/$_abi_release_virtgrsec \
		"$subpkgdir"/lib/modules/
}

md5sums="8c2331a718cfc038963c1214c2ba9811  VirtualBox-5.1.6.tar.bz2"
sha256sums="2e0112b0d85841587b8f212e6ba8f6c35b31e1cce6b6999497dc917cd37e6911  VirtualBox-5.1.6.tar.bz2"
sha512sums="7b10c203692a091b3de8dda147b386e17fa7d2bdb56031163e0551e54c1ff6a8e953361d51cc6f7bb6978544a6517e843b446e866aa1fa6f96b4677dda27daa4  VirtualBox-5.1.6.tar.bz2"