summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/kmod/kmod_git.bb
blob: d9c4d8b525d91def057dd05f266a648ea011f096 (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
# Copyright (C) 2012 Khem Raj <raj.khem@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)

require kmod.inc

PR = "${INC_PR}.1"

PROVIDES += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
RPROVIDES_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
RCONFLICTS_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
RREPLACES_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"

# to force user to remove old module-init-tools and replace them with kmod variants
RCONFLICTS_libkmod2 += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"

# autotools set prefix to /usr, however we want them in /bin and /sbin
bindir = "${base_bindir}"
sbindir = "${base_sbindir}"
libdir = "${base_libdir}"

do_install_append () {
        install -dm755 ${D}${base_bindir}
        install -dm755 ${D}${base_sbindir}
        # add symlinks to kmod
        ln -s ..${base_bindir}/kmod ${D}${base_bindir}/lsmod.kmod
        for tool in {ins,rm,dep}mod mod{info,probe}; do
                ln -s ..${base_bindir}/kmod ${D}${base_sbindir}/${tool}.kmod
        done
        # configuration directories
        install -dm755 ${D}${base_libdir}/depmod.d
        install -dm755 ${D}${base_libdir}/modprobe.d
        install -dm755 ${D}${sysconfdir}/depmod.d
        install -dm755 ${D}${sysconfdir}/modprobe.d

        # install depmod.d file for search/ dir
        install -Dm644 "${WORKDIR}/depmod-search.conf" "${D}${base_libdir}/depmod.d/search.conf"
}

pkg_postinst_kmod() {
        for f in sbin/insmod sbin/modprobe sbin/rmmod sbin/modinfo; do
                bn=`basename $f`
                update-alternatives --install /$f $bn /$f.kmod 60
        done
        update-alternatives --install /bin/lsmod bin-lsmod /bin/lsmod.kmod 60
        update-alternatives --install /sbin/lsmod lsmod /bin/lsmod.kmod 60
        update-alternatives --install /sbin/depmod depmod /sbin/depmod.kmod 60
}

pkg_prerm_kmod() {
        for f in sbin/insmod sbin/modprobe sbin/rmmod sbin/modinfo; do
                bn=`basename $f`
                update-alternatives --remove $bn /$f.kmod
        done
        update-alternatives --remove bin-lsmod /bin/lsmod.kmod
        update-alternatives --remove lsmod /bin/lsmod.kmod
        update-alternatives --remove depmod /sbin/depmod.kmod
}

PACKAGES =+ "libkmod"

FILES_libkmod = "${base_libdir}/libkmod*${SOLIBS} ${libdir}/libkmod*${SOLIBS}"
FILES_${PN} += "${base_libdir}/depmod.d ${base_libdir}/modprobe.d"