blob: ba4d85eda4bc439b64128cedb36cd57b24ff09f5 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001# Copyright (C) 2012 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4require kmod.inc
5
6DEPENDS += "zlib"
7PROVIDES += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
8RPROVIDES_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
9RCONFLICTS_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
10RREPLACES_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
11
12# to force user to remove old module-init-tools and replace them with kmod variants
13RCONFLICTS_libkmod2 += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
14
15# autotools set prefix to /usr, however we want them in /bin and /sbin
16bindir = "${base_bindir}"
17sbindir = "${base_sbindir}"
18# libdir = "${base_libdir}"
19
20do_install_append () {
21 install -dm755 ${D}${base_bindir}
22 install -dm755 ${D}${base_sbindir}
23 # add symlinks to kmod
24 ln -s ..${base_bindir}/kmod ${D}${base_bindir}/lsmod
25 for tool in insmod rmmod depmod modinfo modprobe; do
26 ln -s ..${base_bindir}/kmod ${D}${base_sbindir}/${tool}
27 done
28 # configuration directories
29 install -dm755 ${D}${base_libdir}/depmod.d
30 install -dm755 ${D}${base_libdir}/modprobe.d
31 install -dm755 ${D}${sysconfdir}/depmod.d
32 install -dm755 ${D}${sysconfdir}/modprobe.d
33
34 # install depmod.d file for search/ dir
35 install -Dm644 "${WORKDIR}/depmod-search.conf" "${D}${base_libdir}/depmod.d/search.conf"
36}
37
38do_compile_prepend() {
39 sed -i 's/ac_pwd=/#ac_pwd=/' config.status ; sed -i "/#ac_pwd=/a\ac_pwd='.'" config.status
40}
41
42inherit update-alternatives
43
44ALTERNATIVE_PRIORITY = "60"
45
46ALTERNATIVE_kmod = "insmod modprobe rmmod modinfo bin-lsmod lsmod depmod"
47
48ALTERNATIVE_LINK_NAME[insmod] = "${base_sbindir}/insmod"
49ALTERNATIVE_LINK_NAME[modprobe] = "${base_sbindir}/modprobe"
50ALTERNATIVE_LINK_NAME[rmmod] = "${base_sbindir}/rmmod"
51ALTERNATIVE_LINK_NAME[modinfo] = "${base_sbindir}/modinfo"
52ALTERNATIVE_LINK_NAME[bin-lsmod] = "${base_bindir}/lsmod"
53
54ALTERNATIVE_LINK_NAME[lsmod] = "${base_sbindir}/lsmod"
55ALTERNATIVE_TARGET[lsmod] = "${base_bindir}/lsmod.${BPN}"
56
57ALTERNATIVE_LINK_NAME[depmod] = "${base_sbindir}/depmod"
58
59PACKAGES =+ "libkmod ${PN}-bash-completion"
60
61FILES_libkmod = "${base_libdir}/libkmod*${SOLIBS} ${libdir}/libkmod*${SOLIBS}"
62FILES_${PN} += "${base_libdir}/depmod.d ${base_libdir}/modprobe.d"
63FILES_${PN}-bash-completion = "${datadir}/bash-completion"