/[gentoo-x86]/eclass/linux-mod.eclass
Gentoo

Diff of /eclass/linux-mod.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.108 Revision 1.109
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.108 2012/09/15 16:16:53 zmedico Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.109 2013/03/24 09:54:12 ssuominen Exp $
4 4
5# @ECLASS: linux-mod.eclass 5# @ECLASS: linux-mod.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kernel-misc@gentoo.org 7# kernel-misc@gentoo.org
8# @AUTHOR: 8# @AUTHOR:
75# make ${BUILD_PARAMS} ${BUILD_TARGETS} 75# make ${BUILD_PARAMS} ${BUILD_TARGETS}
76# cd "${S}" 76# cd "${S}"
77# insinto /lib/modules/${KV_FULL}/usb 77# insinto /lib/modules/${KV_FULL}/usb
78# doins module_usb.${KV_OBJ} 78# doins module_usb.${KV_OBJ}
79 79
80# There is also support for automated modprobe.d/modules.d(2.4) file generation. 80# There is also support for automated modprobe.d file generation.
81# This can be explicitly enabled by setting any of the following variables. 81# This can be explicitly enabled by setting any of the following variables.
82 82
83# @ECLASS-VARIABLE: MODULESD_<modulename>_ENABLED 83# @ECLASS-VARIABLE: MODULESD_<modulename>_ENABLED
84# @DESCRIPTION: 84# @DESCRIPTION:
85# This is used to disable the modprobe.d/modules.d file generation otherwise the file will be 85# This is used to disable the modprobe.d file generation otherwise the file will be
86# always generated (unless no MODULESD_<modulename>_* variable is provided). Set to "no" to disable 86# always generated (unless no MODULESD_<modulename>_* variable is provided). Set to "no" to disable
87# the generation of the file and the installation of the documentation. 87# the generation of the file and the installation of the documentation.
88 88
89# @ECLASS-VARIABLE: MODULESD_<modulename>_EXAMPLES 89# @ECLASS-VARIABLE: MODULESD_<modulename>_EXAMPLES
90# @DESCRIPTION: 90# @DESCRIPTION:
91# This is a bash array containing a list of examples which should 91# This is a bash array containing a list of examples which should
92# be used. If you want us to try and take a guess set this to "guess". 92# be used. If you want us to try and take a guess set this to "guess".
93# 93#
94# For each array_component it's added an options line in the modprobe.d/modules.d file 94# For each array_component it's added an options line in the modprobe.d file
95# 95#
96# options array_component 96# options array_component
97# 97#
98# where array_component is "<modulename> options" (see modprobe.conf(5)) 98# where array_component is "<modulename> options" (see modprobe.conf(5))
99 99
100# @ECLASS-VARIABLE: MODULESD_<modulename>_ALIASES 100# @ECLASS-VARIABLE: MODULESD_<modulename>_ALIASES
101# @DESCRIPTION: 101# @DESCRIPTION:
102# This is a bash array containing a list of associated aliases. 102# This is a bash array containing a list of associated aliases.
103# 103#
104# For each array_component it's added an alias line in the modprobe.d/modules.d file 104# For each array_component it's added an alias line in the modprobe.d file
105# 105#
106# alias array_component 106# alias array_component
107# 107#
108# where array_component is "wildcard <modulename>" (see modprobe.conf(5)) 108# where array_component is "wildcard <modulename>" (see modprobe.conf(5))
109 109
233 fi 233 fi
234} 234}
235 235
236# internal function 236# internal function
237# 237#
238# FUNCTION: update_modules
239# DESCRIPTION:
240# It calls the update-modules utility.
241update_modules() {
242 debug-print-function ${FUNCNAME} $*
243
244 if [ -x /sbin/update-modules ] && \
245 grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then
246 ebegin "Updating modules.conf"
247 /sbin/update-modules
248 eend $?
249 elif [ -x /sbin/update-modules ] && \
250 grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then
251 ebegin "Updating modules.conf"
252 /sbin/update-modules
253 eend $?
254 fi
255}
256
257# internal function
258#
259# FUNCTION: move_old_moduledb 238# FUNCTION: move_old_moduledb
260# DESCRIPTION: 239# DESCRIPTION:
261# It updates the location of the database used by the module-rebuild utility. 240# It updates the location of the database used by the module-rebuild utility.
262move_old_moduledb() { 241move_old_moduledb() {
263 debug-print-function ${FUNCNAME} $* 242 debug-print-function ${FUNCNAME} $*
353 332
354# internal function 333# internal function
355# 334#
356# FUNCTION: 335# FUNCTION:
357# USAGE: /path/to/the/modulename_without_extension 336# USAGE: /path/to/the/modulename_without_extension
358# RETURN: A file in /etc/modules.d/ (kernel < 2.6) or /etc/modprobe.d/ (kernel >= 2.6) 337# RETURN: A file in /etc/modprobe.d
359# DESCRIPTION: 338# DESCRIPTION:
360# This function will generate and install the neccessary modprobe.d/modules.d file from the 339# This function will generate and install the neccessary modprobe.d file from the
361# information contained in the modules exported parms. 340# information contained in the modules exported parms.
362# (see the variables MODULESD_<modulename>_ENABLED, MODULESD_<modulename>_EXAMPLES, 341# (see the variables MODULESD_<modulename>_ENABLED, MODULESD_<modulename>_EXAMPLES,
363# MODULESD_<modulename>_ALIASES, MODULESD_<modulename>_ADDITION and MODULESD_<modulename>_DOCS). 342# MODULESD_<modulename>_ALIASES, MODULESD_<modulename>_ADDITION and MODULESD_<modulename>_DOCS).
364# 343#
365# At the end the documentation specified with MODULESD_<modulename>_DOCS is installed. 344# At the end the documentation specified with MODULESD_<modulename>_DOCS is installed.
400 done 379 done
401 380
402 [[ -z ${!module_*} ]] && return 0 381 [[ -z ${!module_*} ]] && return 0
403 382
404 # OK so now if we have got this far, then we know we want to continue 383 # OK so now if we have got this far, then we know we want to continue
405 # and generate the modules.d file. 384 # and generate the modprobe.d file.
406 module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})" 385 module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})"
407 module_config="${T}/modulesd-${currm}" 386 module_config="${T}/modulesd-${currm}"
408 387
409 ebegin "Preparing file for modules.d" 388 ebegin "Preparing file for modprobe.d"
410 #----------------------------------------------------------------------- 389 #-----------------------------------------------------------------------
411 echo "# modules.d configuration file for ${currm}" >> "${module_config}" 390 echo "# modprobe.d configuration file for ${currm}" >> "${module_config}"
412 #----------------------------------------------------------------------- 391 #-----------------------------------------------------------------------
413 [[ -n ${module_docs} ]] && \ 392 [[ -n ${module_docs} ]] && \
414 echo "# For more information please read:" >> "${module_config}" 393 echo "# For more information please read:" >> "${module_config}"
415 for t in ${module_docs} 394 for t in ${module_docs}
416 do 395 do
492 fi 471 fi
493 472
494 #----------------------------------------------------------------------- 473 #-----------------------------------------------------------------------
495 474
496 # then we install it 475 # then we install it
497 if kernel_is ge 2 6; then
498 insinto /etc/modprobe.d 476 insinto /etc/modprobe.d
499 else
500 insinto /etc/modules.d
501 fi
502 newins "${module_config}" "${currm_path//*\/}.conf" 477 newins "${module_config}" "${currm_path//*\/}.conf"
503 478
504 # and install any documentation we might have. 479 # and install any documentation we might have.
505 [[ -n ${module_docs} ]] && dodoc ${module_docs} 480 [[ -n ${module_docs} ]] && dodoc ${module_docs}
506 done 481 done
685# @FUNCTION: linux-mod_src_install 660# @FUNCTION: linux-mod_src_install
686# @DESCRIPTION: 661# @DESCRIPTION:
687# It install the modules specified in MODULES_NAME. The modules should be inside the ${objdir} 662# It install the modules specified in MODULES_NAME. The modules should be inside the ${objdir}
688# directory and they are installed inside /lib/modules/${KV_FULL}/${libdir}. 663# directory and they are installed inside /lib/modules/${KV_FULL}/${libdir}.
689# 664#
690# The modprobe.d/modules.d configuration file is automatically generated if the 665# The modprobe.d configuration file is automatically generated if the
691# MODULESD_<modulename>_* variables are defined. The only way to stop this process is by 666# MODULESD_<modulename>_* variables are defined. The only way to stop this process is by
692# setting MODULESD_<modulename>_ENABLED=no. At the end the documentation specified via 667# setting MODULESD_<modulename>_ENABLED=no. At the end the documentation specified via
693# MODULESD_<modulename>_DOCS is also installed. 668# MODULESD_<modulename>_DOCS is also installed.
694# 669#
695# Look at the description of these variables for more details. 670# Look at the description of these variables for more details.
725# It checks what to do after having merged the package. 700# It checks what to do after having merged the package.
726linux-mod_pkg_preinst() { 701linux-mod_pkg_preinst() {
727 debug-print-function ${FUNCNAME} $* 702 debug-print-function ${FUNCNAME} $*
728 703
729 [ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false 704 [ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false
730 [ -d "${D}etc/modules.d" ] && UPDATE_MODULES=true || UPDATE_MODULES=false
731 [ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false 705 [ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false
732} 706}
733 707
734# @FUNCTION: linux-mod_pkg_postinst 708# @FUNCTION: linux-mod_pkg_postinst
735# @DESCRIPTION: 709# @DESCRIPTION:
736# It executes /sbin/depmod and adds the package to the /var/lib/module-rebuild/moduledb 710# It executes /sbin/depmod and adds the package to the /var/lib/module-rebuild/moduledb
737# database (if ${D}/lib/modules is created) and it runs /sbin/update-modules
738# (if ${D}/etc/modules.d is created). 711# database (if ${D}/lib/modules is created)"
739linux-mod_pkg_postinst() { 712linux-mod_pkg_postinst() {
740 debug-print-function ${FUNCNAME} $* 713 debug-print-function ${FUNCNAME} $*
741 714
742 ${UPDATE_DEPMOD} && update_depmod; 715 ${UPDATE_DEPMOD} && update_depmod;
743 ${UPDATE_MODULES} && update_modules;
744 ${UPDATE_MODULEDB} && update_moduledb; 716 ${UPDATE_MODULEDB} && update_moduledb;
745} 717}
746 718
747# @FUNCTION: linux-mod_pkg_postrm 719# @FUNCTION: linux-mod_pkg_postrm
748# @DESCRIPTION: 720# @DESCRIPTION:
749# It removes the package from the /var/lib/module-rebuild/moduledb database but it doens't 721# It removes the package from the /var/lib/module-rebuild/moduledb database but it doens't
750# call /sbin/depmod and /sbin/update-modules because the modules are still installed. 722# call /sbin/depmod because the modules are still installed.
751linux-mod_pkg_postrm() { 723linux-mod_pkg_postrm() {
752 debug-print-function ${FUNCNAME} $* 724 debug-print-function ${FUNCNAME} $*
753 remove_moduledb; 725 remove_moduledb;
754} 726}

Legend:
Removed from v.1.108  
changed lines
  Added in v.1.109

  ViewVC Help
Powered by ViewVC 1.1.20