summaryrefslogtreecommitdiff
blob: 81617cdde7c6d632530158922d19c3834d919fd6 (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit linux-info optfeature

DESCRIPTION="Dynamic Kernel Module Support"
HOMEPAGE="https://github.com/dell/dkms"
SRC_URI="https://github.com/dell/dkms/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"

IUSE="systemd"

CONFIG_CHECK="~MODULES"

RDEPEND="
	sys-apps/kmod
	virtual/linux-sources
	systemd? ( sys-apps/systemd )
"

# Can not work in the emerge sandbox
RESTRICT="test"

src_compile() {
	# Nothing to do here
	return
}

src_test() {
	chmod +x dkms || die
	PATH="${PATH}:$(pwd)" ./run_test.sh || die "Tests failed"
}

src_install() {
	if use systemd; then
		emake install-redhat DESTDIR="${ED}" KCONF="/usr/lib/kernel"
	else
		emake install DESTDIR="${ED}" KCONF="/usr/lib/kernel"
	fi
	# Backwards compatibility with sys-kernel/installkernel[-systemd]
	dosym ../../../usr/lib/kernel/postinst.d/dkms /etc/kernel/postinst.d/dkms
	dosym ../../../usr/lib/kernel/prerm.d/dkms /etc/kernel/prerm.d/dkms
	einstalldocs
	keepdir /var/lib/dkms
}

pkg_postinst() {
	optfeature "automatically running \"dkms autoinstall\" on each kernel installation" \
		"sys-kernel/installkernel[systemd]"
}