1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: linux-mod.eclass
8 # John Mylchreest <johnm@gentoo.org>,
9 # Stefan Schweizer <genstef@gentoo.org>
10 # @BLURB: It provides the functionality required to install external modules against a kernel source tree.
12 # This eclass is used to interface with linux-info.eclass in such a way
13 # to provide the functionality and initial functions
14 # required to install external modules against a kernel source
17 # A Couple of env vars are available to effect usage of this eclass
18 # These are as follows:
20 # @ECLASS-VARIABLE: MODULES_OPTIONAL_USE
22 # A string containing the USE flag to use for making this eclass optional
23 # The recommended non-empty value is 'modules'
25 # @ECLASS-VARIABLE: KERNEL_DIR
27 # A string containing the directory of the target kernel sources. The default value is
30 # @ECLASS-VARIABLE: ECONF_PARAMS
32 # It's a string containing the parameters to pass to econf.
33 # If this is not set, then econf isn't run.
35 # @ECLASS-VARIABLE: BUILD_PARAMS
37 # It's a string with the parameters to pass to emake.
39 # @ECLASS-VARIABLE: BUILD_TARGETS
41 # It's a string with the build targets to pass to make. The default value is "clean module"
43 # @ECLASS-VARIABLE: MODULE_NAMES
45 # It's a string containing the modules to be built automatically using the default
46 # src_compile/src_install. It will only make ${BUILD_TARGETS} once in any directory.
48 # The structure of each MODULE_NAMES entry is as follows:
50 # modulename(libdir:srcdir:objdir)
54 # modulename = name of the module file excluding the .ko
55 # libdir = place in system modules directory where module is installed (by default it's misc)
56 # srcdir = place for ebuild to cd to before running make (by default it's ${S})
57 # objdir = place the .ko and objects are located after make runs (by default it's set to srcdir)
59 # To get an idea of how these variables are used, here's a few lines
60 # of code from around line 540 in this eclass:
62 # einfo "Installing ${modulename} module"
63 # cd ${objdir} || die "${objdir} does not exist"
64 # insinto /lib/modules/${KV_FULL}/${libdir}
65 # doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
68 # MODULE_NAMES="module_pci(pci:${S}/pci:${S}) module_usb(usb:${S}/usb:${S})"
70 # what this would do is
73 # make ${BUILD_PARAMS} ${BUILD_TARGETS}
75 # insinto /lib/modules/${KV_FULL}/pci
76 # doins module_pci.${KV_OBJ}
79 # make ${BUILD_PARAMS} ${BUILD_TARGETS}
81 # insinto /lib/modules/${KV_FULL}/usb
82 # doins module_usb.${KV_OBJ}
84 # There is also support for automated modprobe.d file generation.
85 # This can be explicitly enabled by setting any of the following variables.
87 # @ECLASS-VARIABLE: MODULESD_<modulename>_ENABLED
89 # This is used to disable the modprobe.d file generation otherwise the file will be
90 # always generated (unless no MODULESD_<modulename>_* variable is provided). Set to "no" to disable
91 # the generation of the file and the installation of the documentation.
93 # @ECLASS-VARIABLE: MODULESD_<modulename>_EXAMPLES
95 # This is a bash array containing a list of examples which should
96 # be used. If you want us to try and take a guess set this to "guess".
98 # For each array_component it's added an options line in the modprobe.d file
100 # options array_component
102 # where array_component is "<modulename> options" (see modprobe.conf(5))
104 # @ECLASS-VARIABLE: MODULESD_<modulename>_ALIASES
106 # This is a bash array containing a list of associated aliases.
108 # For each array_component it's added an alias line in the modprobe.d file
110 # alias array_component
112 # where array_component is "wildcard <modulename>" (see modprobe.conf(5))
114 # @ECLASS-VARIABLE: MODULESD_<modulename>_ADDITIONS
116 # This is a bash array containing a list of additional things to
117 # add to the bottom of the file. This can be absolutely anything.
118 # Each entry is a new line.
120 # @ECLASS-VARIABLE: MODULESD_<modulename>_DOCS
122 # This is a string list which contains the full path to any associated
123 # documents for <modulename>. These files are installed in the live tree.
125 # @ECLASS-VARIABLE: KV_OBJ
127 # It's a read-only variable. It contains the extension of the kernel modules.
129 inherit eutils linux-info multilib
130 EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm
132 IUSE="kernel_linux ${MODULES_OPTIONAL_USE}"
134 RDEPEND="${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (} kernel_linux? ( virtual/modutils ) ${MODULES_OPTIONAL_USE:+)}"
136 ${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (}
138 kernel_linux? ( virtual/linux-sources )
139 ${MODULES_OPTIONAL_USE:+)}"
142 # ----------------------------------
145 debug-print-function ${FUNCNAME} $*
147 local curr_gcc_ver=$(gcc -dumpversion)
148 local tmpfile old_chost old_gcc_ver result=0
149 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
151 tmpfile=`find "${KV_DIR}/" -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit`
152 tmpfile=${tmpfile//*usr/lib}
153 tmpfile=${tmpfile//\/include*}
154 old_chost=${tmpfile//*gcc\/}
155 old_chost=${old_chost//\/*}
156 old_gcc_ver=${tmpfile//*\/}
158 if [[ -z ${old_gcc_ver} || -z ${old_chost} ]]; then
160 ewarn "Unable to detect what version of GCC was used to compile"
161 ewarn "the kernel. Build will continue, but you may experience problems."
162 elif [[ ${curr_gcc_ver} != ${old_gcc_ver} ]]; then
164 ewarn "The version of GCC you are using (${curr_gcc_ver}) does"
165 ewarn "not match the version of GCC used to compile the"
166 ewarn "kernel (${old_gcc_ver})."
168 elif [[ ${CHOST} != ${old_chost} ]]; then
170 ewarn "The current CHOST (${CHOST}) does not match the chost"
171 ewarn "used when compiling the kernel (${old_chost})."
175 if [[ ${result} -gt 0 ]]; then
177 ewarn "Build will not continue, because you will experience problems."
178 ewarn "To fix this either change the version of GCC you wish to use"
179 ewarn "to match the kernel, or recompile the kernel first."
180 die "GCC Version Mismatch."
185 # @RETURN: true or false
187 # It checks if the kernel version is greater than 2.6.5.
189 debug-print-function ${FUNCNAME} $*
191 # if we haven't determined the version yet, we need too.
194 # if the kernel version is greater than 2.6.6 then we should use
195 # M= instead of SUBDIRS=
196 [ ${KV_MAJOR} -eq 3 ] && return 0
197 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \
201 # @FUNCTION: convert_to_m
202 # @USAGE: /path/to/the/file
204 # It converts a file (e.g. a makefile) to use M= instead of SUBDIRS=
206 debug-print-function ${FUNCNAME} $*
211 die "convert_to_m() requires a filename as an argument"
212 ebegin "Converting ${1/${WORKDIR}\//} to use M= instead of SUBDIRS="
213 sed -i 's:SUBDIRS=:M=:g' "${1}"
220 # FUNCTION: update_depmod
222 # It updates the modules.dep file for the current kernel.
224 debug-print-function ${FUNCNAME} $*
226 # if we haven't determined the version yet, we need too.
229 ebegin "Updating module dependencies for ${KV_FULL}"
230 if [ -r "${KV_OUT_DIR}"/System.map ]
232 depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" ${KV_FULL}
236 ewarn "${KV_OUT_DIR}/System.map not found."
237 ewarn "You must manually update the kernel module dependencies using depmod."
245 # FUNCTION: move_old_moduledb
247 # It updates the location of the database used by the module-rebuild utility.
248 move_old_moduledb() {
249 debug-print-function ${FUNCNAME} $*
251 local OLDDIR="${ROOT}"/usr/share/module-rebuild/
252 local NEWDIR="${ROOT}"/var/lib/module-rebuild/
254 if [[ -f "${OLDDIR}"/moduledb ]]; then
255 [[ ! -d "${NEWDIR}" ]] && mkdir -p "${NEWDIR}"
256 [[ ! -f "${NEWDIR}"/moduledb ]] && \
257 mv "${OLDDIR}"/moduledb "${NEWDIR}"/moduledb
265 # FUNCTION: update_moduledb
267 # It adds the package to the /var/lib/module-rebuild/moduledb database used by the module-rebuild utility.
269 debug-print-function ${FUNCNAME} $*
271 local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/
274 if [[ ! -f "${MODULEDB_DIR}"/moduledb ]]; then
275 [[ ! -d "${MODULEDB_DIR}" ]] && mkdir -p "${MODULEDB_DIR}"
276 touch "${MODULEDB_DIR}"/moduledb
279 if ! grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then
280 einfo "Adding module to moduledb."
281 echo "a:1:${CATEGORY}/${PN}-${PVR}" >> "${MODULEDB_DIR}"/moduledb
287 # FUNCTION: remove_moduledb
289 # It removes the package from the /var/lib/module-rebuild/moduledb database used by
290 # the module-rebuild utility.
292 debug-print-function ${FUNCNAME} $*
294 local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/
297 if grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then
298 einfo "Removing ${CATEGORY}/${PN}-${PVR} from moduledb."
299 sed -i -e "/.*${CATEGORY}\/${PN}-${PVR}.*/d" "${MODULEDB_DIR}"/moduledb
303 # @FUNCTION: set_kvobj
305 # It sets the KV_OBJ variable.
307 debug-print-function ${FUNCNAME} $*
315 # Do we really need to know this?
317 # einfo "Using KV_OBJ=${KV_OBJ}"
321 debug-print-function ${FUNCNAME} $*
323 if [[ -n ${KERNEL_CC} ]] ; then
329 if [ -n "${KERNEL_ABI}" ]; then
330 # In future, an arch might want to define CC_$ABI
331 #kernel_cc="$(get_abi_CC)"
332 #[ -z "${kernel_cc}" ] &&
333 kernel_cc="$(tc-getCC $(ABI=${KERNEL_ABI} get_abi_CHOST))"
335 kernel_cc=$(tc-getCC)
343 # USAGE: /path/to/the/modulename_without_extension
344 # RETURN: A file in /etc/modprobe.d
346 # This function will generate and install the neccessary modprobe.d file from the
347 # information contained in the modules exported parms.
348 # (see the variables MODULESD_<modulename>_ENABLED, MODULESD_<modulename>_EXAMPLES,
349 # MODULESD_<modulename>_ALIASES, MODULESD_<modulename>_ADDITION and MODULESD_<modulename>_DOCS).
351 # At the end the documentation specified with MODULESD_<modulename>_DOCS is installed.
352 generate_modulesd() {
353 debug-print-function ${FUNCNAME} $*
354 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
356 local currm_path currm currm_t t myIFS myVAR
357 local module_docs module_enabled module_aliases \
358 module_additions module_examples module_modinfo module_opts
360 for currm_path in ${@}
362 currm=${currm_path//*\/}
363 currm=$(echo ${currm} | tr '[:lower:]' '[:upper:]')
365 while [[ -z ${currm_t//*-*} ]]; do
366 currm_t=${currm_t/-/_}
369 module_docs="$(eval echo \${MODULESD_${currm_t}_DOCS})"
370 module_enabled="$(eval echo \${MODULESD_${currm_t}_ENABLED})"
371 module_aliases="$(eval echo \${#MODULESD_${currm_t}_ALIASES[*]})"
372 module_additions="$(eval echo \${#MODULESD_${currm_t}_ADDITIONS[*]})"
373 module_examples="$(eval echo \${#MODULESD_${currm_t}_EXAMPLES[*]})"
375 [[ ${module_aliases} -eq 0 ]] && unset module_aliases
376 [[ ${module_additions} -eq 0 ]] && unset module_additions
377 [[ ${module_examples} -eq 0 ]] && unset module_examples
379 # If we specify we dont want it, then lets exit, otherwise we assume
380 # that if its set, we do want it.
381 [[ ${module_enabled} == no ]] && return 0
383 # unset any unwanted variables.
384 for t in ${!module_*}
386 [[ -z ${!t} ]] && unset ${t}
389 [[ -z ${!module_*} ]] && return 0
391 # OK so now if we have got this far, then we know we want to continue
392 # and generate the modprobe.d file.
393 module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})"
394 module_config="${T}/modulesd-${currm}"
396 ebegin "Preparing file for modprobe.d"
397 #-----------------------------------------------------------------------
398 echo "# modprobe.d configuration file for ${currm}" >> "${module_config}"
399 #-----------------------------------------------------------------------
400 [[ -n ${module_docs} ]] && \
401 echo "# For more information please read:" >> "${module_config}"
402 for t in ${module_docs}
404 echo "# ${t//*\/}" >> "${module_config}"
406 echo >> "${module_config}"
408 #-----------------------------------------------------------------------
409 if [[ ${module_aliases} -gt 0 ]]
411 echo "# Internal Aliases - Do not edit" >> "${module_config}"
412 echo "# ------------------------------" >> "${module_config}"
414 for((t=0; t<${module_aliases}; t++))
416 echo "alias $(eval echo \${MODULESD_${currm}_ALIASES[$t]})" \
417 >> "${module_config}"
419 echo '' >> "${module_config}"
422 #-----------------------------------------------------------------------
423 if [[ -n ${module_modinfo} ]]
425 echo >> "${module_config}"
426 echo "# Configurable module parameters" >> "${module_config}"
427 echo "# ------------------------------" >> "${module_config}"
429 IFS="$(echo -en "\n\b")"
431 for t in ${module_modinfo}
433 myVAR="$(echo ${t#*:} | grep -o "[^ ]*[0-9][ =][^ ]*" | tail -1 | grep -o "[0-9]")"
436 module_opts="${module_opts} ${t%%:*}:${myVAR}"
438 echo -e "# ${t%%:*}:\t${t#*:}" >> "${module_config}"
441 echo '' >> "${module_config}"
444 #-----------------------------------------------------------------------
445 if [[ $(eval echo \${MODULESD_${currm}_ALIASES[0]}) == guess ]]
447 # So lets do some guesswork eh?
448 if [[ -n ${module_opts} ]]
450 echo "# For Example..." >> "${module_config}"
451 echo "# --------------" >> "${module_config}"
452 for t in ${module_opts}
454 echo "# options ${currm} ${t//:*}=${t//*:}" >> "${module_config}"
456 echo '' >> "${module_config}"
458 elif [[ ${module_examples} -gt 0 ]]
460 echo "# For Example..." >> "${module_config}"
461 echo "# --------------" >> "${module_config}"
462 for((t=0; t<${module_examples}; t++))
464 echo "options $(eval echo \${MODULESD_${currm}_EXAMPLES[$t]})" \
465 >> "${module_config}"
467 echo '' >> "${module_config}"
470 #-----------------------------------------------------------------------
471 if [[ ${module_additions} -gt 0 ]]
473 for((t=0; t<${module_additions}; t++))
475 echo "$(eval echo \${MODULESD_${currm}_ADDITIONS[$t]})" \
476 >> "${module_config}"
478 echo '' >> "${module_config}"
481 #-----------------------------------------------------------------------
484 insinto /etc/modprobe.d
485 newins "${module_config}" "${currm_path//*\/}.conf"
487 # and install any documentation we might have.
488 [[ -n ${module_docs} ]] && dodoc ${module_docs}
496 # FUNCTION: find_module_params
497 # USAGE: A string "NAME(LIBDIR:SRCDIR:OBJDIR)"
498 # RETURN: The string "modulename:NAME libdir:LIBDIR srcdir:SRCDIR objdir:OBJDIR"
500 # Analyze the specification NAME(LIBDIR:SRCDIR:OBJDIR) of one module as described in MODULE_NAMES.
501 find_module_params() {
502 debug-print-function ${FUNCNAME} $*
504 local matched_offset=0 matched_opts=0 test="${@}" temp_var result
507 for((i=0; i<=${#test}; i++))
509 case ${test:${i}:1} in
510 \() matched_offset[0]=${i};;
511 \:) matched_opts=$((${matched_opts} + 1));
512 matched_offset[${matched_opts}]="${i}";;
513 \)) matched_opts=$((${matched_opts} + 1));
514 matched_offset[${matched_opts}]="${i}";;
518 for((i=0; i<=${matched_opts}; i++))
520 # i = offset were working on
522 # z = current offset - last offset
523 # temp_var = temporary name
525 0) tempvar=${test:0:${matched_offset[0]}};;
526 *) y=$((${matched_offset[$((${i} - 1))]} + 1))
527 z=$((${matched_offset[${i}]} - ${matched_offset[$((${i} - 1))]}));
529 tempvar=${test:${y}:${z}};;
533 0) result="${result} modulename:${tempvar}";;
534 1) result="${result} libdir:${tempvar}";;
535 2) result="${result} srcdir:${tempvar}";;
536 3) result="${result} objdir:${tempvar}";;
543 # default ebuild functions
544 # --------------------------------
546 # @FUNCTION: linux-mod_pkg_setup
548 # It checks the CONFIG_CHECK options (see linux-info.eclass(5)), verifies that the kernel is
549 # configured, verifies that the sources are prepared, verifies that the modules support is builtin
550 # in the kernel and sets the object extension KV_OBJ.
551 linux-mod_pkg_setup() {
552 debug-print-function ${FUNCNAME} $*
553 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
555 local is_bin="${MERGE_TYPE}"
557 # If we are installing a binpkg, take a different path.
558 # use MERGE_TYPE if available (eapi>=4); else use non-PMS EMERGE_FROM (eapi<4)
559 if has ${EAPI} 0 1 2 3; then
560 is_bin=${EMERGE_FROM}
563 if [[ ${is_bin} == binary ]]; then
564 linux-mod_pkg_setup_binary
568 # External modules use kernel symbols (bug #591832)
569 CONFIG_CHECK+=" !TRIM_UNUSED_KSYMS"
571 linux-info_pkg_setup;
572 require_configured_kernel
575 [[ -n ${MODULE_NAMES} ]] && check_modules_supported
577 # Commented out with permission from johnm until a fixed version for arches
578 # who intentionally use different kernel and userland compilers can be
579 # introduced - Jason Wever <weeve@gentoo.org>, 23 Oct 2005
583 # @FUNCTION: linux-mod_pkg_setup_binary
585 # Perform all kernel option checks non-fatally, as the .config and
586 # /proc/config.gz might not be present. Do not do anything that requires kernel
588 linux-mod_pkg_setup_binary() {
589 debug-print-function ${FUNCNAME} $*
590 local new_CONFIG_CHECK
591 # ~ needs always to be quoted, else bash expands it.
592 for config in $CONFIG_CHECK ; do
594 [[ ${config:0:1} == "~" ]] && optional=''
595 new_CONFIG_CHECK="${new_CONFIG_CHECK} ${optional}${config}"
597 CONFIG_CHECK="${new_CONFIG_CHECK}"
598 linux-info_pkg_setup;
601 strip_modulenames() {
602 debug-print-function ${FUNCNAME} $*
605 for i in ${MODULE_IGNORE}; do
606 MODULE_NAMES=${MODULE_NAMES//${i}(*}
610 # @FUNCTION: linux-mod_src_compile
612 # It compiles all the modules specified in MODULE_NAMES. For each module the econf command is
613 # executed only if ECONF_PARAMS is defined, the name of the target is specified by BUILD_TARGETS
614 # while the options are in BUILD_PARAMS (all the modules share these variables). The compilation
615 # happens inside ${srcdir}.
617 # Look at the description of these variables for more details.
618 linux-mod_src_compile() {
619 debug-print-function ${FUNCNAME} $*
620 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
622 local modulename libdir srcdir objdir i n myABI="${ABI}"
626 BUILD_TARGETS=${BUILD_TARGETS:-clean module}
630 for i in ${MODULE_NAMES}
632 unset libdir srcdir objdir
633 for n in $(find_module_params ${i})
635 eval ${n/:*}=${n/*:/}
637 libdir=${libdir:-misc}
638 srcdir=${srcdir:-${S}}
639 objdir=${objdir:-${srcdir}}
641 if [ ! -f "${srcdir}/.built" ];
644 ln -s "${S}"/Module.symvers Module.symvers
645 einfo "Preparing ${modulename} module"
646 if [[ -n ${ECONF_PARAMS} ]]
648 econf ${ECONF_PARAMS} || \
649 die "Unable to run econf ${ECONF_PARAMS}"
652 # This looks messy, but it is needed to handle multiple variables
653 # being passed in the BUILD_* stuff where the variables also have
654 # spaces that must be preserved. If don't do this, then the stuff
655 # inside the variables gets used as targets for Make, which then
657 eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \
658 CROSS_COMPILE=${CHOST}- \
659 LDFLAGS=\"$(get_abi_LDFLAGS)\" \
663 || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
665 touch "${srcdir}"/.built
673 # @FUNCTION: linux-mod_src_install
675 # It install the modules specified in MODULES_NAME. The modules should be inside the ${objdir}
676 # directory and they are installed inside /lib/modules/${KV_FULL}/${libdir}.
678 # The modprobe.d configuration file is automatically generated if the
679 # MODULESD_<modulename>_* variables are defined. The only way to stop this process is by
680 # setting MODULESD_<modulename>_ENABLED=no. At the end the documentation specified via
681 # MODULESD_<modulename>_DOCS is also installed.
683 # Look at the description of these variables for more details.
684 linux-mod_src_install() {
685 debug-print-function ${FUNCNAME} $*
686 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
688 local modulename libdir srcdir objdir i n
691 for i in ${MODULE_NAMES}
693 unset libdir srcdir objdir
694 for n in $(find_module_params ${i})
696 eval ${n/:*}=${n/*:/}
698 libdir=${libdir:-misc}
699 srcdir=${srcdir:-${S}}
700 objdir=${objdir:-${srcdir}}
702 einfo "Installing ${modulename} module"
703 cd "${objdir}" || die "${objdir} does not exist"
704 insinto /lib/modules/${KV_FULL}/${libdir}
705 doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
708 generate_modulesd "${objdir}/${modulename}"
712 # @FUNCTION: linux-mod_pkg_preinst
714 # It checks what to do after having merged the package.
715 linux-mod_pkg_preinst() {
716 debug-print-function ${FUNCNAME} $*
717 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
719 [ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false
720 [ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false
723 # @FUNCTION: linux-mod_pkg_postinst
725 # It executes /sbin/depmod and adds the package to the /var/lib/module-rebuild/moduledb
726 # database (if ${D}/lib/modules is created)"
727 linux-mod_pkg_postinst() {
728 debug-print-function ${FUNCNAME} $*
729 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
731 ${UPDATE_DEPMOD} && update_depmod;
732 ${UPDATE_MODULEDB} && update_moduledb;
735 # @FUNCTION: linux-mod_pkg_postrm
737 # It removes the package from the /var/lib/module-rebuild/moduledb database but it doens't
738 # call /sbin/depmod because the modules are still installed.
739 linux-mod_pkg_postrm() {
740 debug-print-function ${FUNCNAME} $*
741 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return