Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame^] | 1 | # Copyright (C) 2012 Khem Raj <raj.khem@gmail.com> |
| 2 | # Released under the MIT license (see COPYING.MIT for the terms) |
| 3 | |
| 4 | require kmod.inc |
| 5 | |
| 6 | DEPENDS += "zlib" |
| 7 | PROVIDES += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools" |
| 8 | RPROVIDES_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools" |
| 9 | RCONFLICTS_${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools" |
| 10 | RREPLACES_${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 |
| 13 | RCONFLICTS_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 |
| 16 | bindir = "${base_bindir}" |
| 17 | sbindir = "${base_sbindir}" |
| 18 | # libdir = "${base_libdir}" |
| 19 | |
| 20 | do_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 | |
| 38 | do_compile_prepend() { |
| 39 | sed -i 's/ac_pwd=/#ac_pwd=/' config.status ; sed -i "/#ac_pwd=/a\ac_pwd='.'" config.status |
| 40 | } |
| 41 | |
| 42 | inherit update-alternatives |
| 43 | |
| 44 | ALTERNATIVE_PRIORITY = "60" |
| 45 | |
| 46 | ALTERNATIVE_kmod = "insmod modprobe rmmod modinfo bin-lsmod lsmod depmod" |
| 47 | |
| 48 | ALTERNATIVE_LINK_NAME[insmod] = "${base_sbindir}/insmod" |
| 49 | ALTERNATIVE_LINK_NAME[modprobe] = "${base_sbindir}/modprobe" |
| 50 | ALTERNATIVE_LINK_NAME[rmmod] = "${base_sbindir}/rmmod" |
| 51 | ALTERNATIVE_LINK_NAME[modinfo] = "${base_sbindir}/modinfo" |
| 52 | ALTERNATIVE_LINK_NAME[bin-lsmod] = "${base_bindir}/lsmod" |
| 53 | |
| 54 | ALTERNATIVE_LINK_NAME[lsmod] = "${base_sbindir}/lsmod" |
| 55 | ALTERNATIVE_TARGET[lsmod] = "${base_bindir}/lsmod.${BPN}" |
| 56 | |
| 57 | ALTERNATIVE_LINK_NAME[depmod] = "${base_sbindir}/depmod" |
| 58 | |
| 59 | PACKAGES =+ "libkmod ${PN}-bash-completion" |
| 60 | |
| 61 | FILES_libkmod = "${base_libdir}/libkmod*${SOLIBS} ${libdir}/libkmod*${SOLIBS}" |
| 62 | FILES_${PN} += "${base_libdir}/depmod.d ${base_libdir}/modprobe.d" |
| 63 | FILES_${PN}-bash-completion = "${datadir}/bash-completion" |