1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 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.36 2005/04/25 18:47:12 johnm Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.37 2005/05/03 22:55:03 johnm Exp $ |
4 | |
4 | |
5 | # Description: This eclass is used to interface with linux-info in such a way |
5 | # Description: This eclass is used to interface with linux-info in such a way |
6 | # to provide the functionality required and initial functions |
6 | # to provide the functionality required and initial functions |
7 | # required to install external modules against a kernel source |
7 | # required to install external modules against a kernel source |
8 | # tree. |
8 | # tree. |
… | |
… | |
80 | |
80 | |
81 | |
81 | |
82 | inherit linux-info |
82 | inherit linux-info |
83 | ECLASS=linux-mod |
83 | ECLASS=linux-mod |
84 | INHERITED="$INHERITED $ECLASS" |
84 | INHERITED="$INHERITED $ECLASS" |
85 | EXPORT_FUNCTIONS pkg_setup pkg_postinst src_install src_compile |
85 | EXPORT_FUNCTIONS pkg_setup pkg_postinst src_install src_compile pkg_postrm |
86 | |
86 | |
|
|
87 | IUSE="${IUSE} pcmcia" |
87 | SLOT="0" |
88 | SLOT="0" |
88 | DESCRIPTION="Based on the $ECLASS eclass" |
89 | DESCRIPTION="Based on the $ECLASS eclass" |
89 | DEPEND="virtual/linux-sources |
90 | DEPEND="virtual/linux-sources |
90 | sys-apps/sed |
91 | sys-apps/sed |
91 | virtual/modutils |
92 | virtual/modutils |
… | |
… | |
182 | if [ -x /sbin/modules-update ] && \ |
183 | if [ -x /sbin/modules-update ] && \ |
183 | grep -v -e "^#" -e "^$" ${D}/etc/modules.d/* >/dev/null 2>&1; then |
184 | grep -v -e "^#" -e "^$" ${D}/etc/modules.d/* >/dev/null 2>&1; then |
184 | ebegin "Updating modules.conf" |
185 | ebegin "Updating modules.conf" |
185 | /sbin/modules-update |
186 | /sbin/modules-update |
186 | eend $? |
187 | eend $? |
|
|
188 | fi |
|
|
189 | } |
|
|
190 | |
|
|
191 | update_moduledb() { |
|
|
192 | if [[ ! -f ${ROOT}/usr/share/module-rebuild/moduledb ]]; then |
|
|
193 | [[ ! -d ${ROOT}/usr/share/module-rebuild/ ]] && mkdir ${ROOT}/usr/share/module-rebuild/ |
|
|
194 | touch ${ROOT}/usr/share/module-rebuild/moduledb |
|
|
195 | fi |
|
|
196 | if [[ -z $(grep ${CATEGORY}/${PN}-${PVR} ${ROOT}/usr/share/module-rebuild/moduledb) ]]; then |
|
|
197 | einfo "Adding module to moduledb." |
|
|
198 | echo "a:1:${CATEGORY}/${PN}-${PVR}" >> ${ROOT}/usr/share/module-rebuild/moduledb |
|
|
199 | fi |
|
|
200 | } |
|
|
201 | |
|
|
202 | remove_moduledb() { |
|
|
203 | if [[ -n $(grep ${CATEGORY}/${PN}-${PVR} ${ROOT}/usr/share/module-rebuild/moduledb) ]]; then |
|
|
204 | einfo "Removing ${CATEGORY}/${PN}-${PVR} from moduledb." |
|
|
205 | sed -ie "/.*${CATEGORY}\/${P}.*/d" ${ROOT}/usr/share/module-rebuild/moduledb |
187 | fi |
206 | fi |
188 | } |
207 | } |
189 | |
208 | |
190 | set_kvobj() { |
209 | set_kvobj() { |
191 | if kernel_is 2 6 |
210 | if kernel_is 2 6 |
… | |
… | |
491 | } |
510 | } |
492 | |
511 | |
493 | linux-mod_pkg_postinst() { |
512 | linux-mod_pkg_postinst() { |
494 | update_depmod; |
513 | update_depmod; |
495 | update_modules; |
514 | update_modules; |
|
|
515 | update_moduledb; |
496 | display_postinst; |
516 | display_postinst; |
497 | } |
517 | } |
|
|
518 | |
|
|
519 | linux-mod_pkg_postrm() { |
|
|
520 | remove_moduledb; |
|
|
521 | } |