--- /usr/portage/eclass/kernel-mod.eclass 2004-10-07 00:05:41.000000000 +0200 +++ /usr/local/portage/eclass/kernel-mod.eclass 2004-10-29 12:43:51.708347664 +0200 @@ -28,6 +28,12 @@ kernel-mod_getversion () # KV_DIR contains the real directory name of the directory containing # the Linux kernel that we are going to compile against + if [ -n "${KV_VERSION_FULL}" ] + then + # no need to run kernel-mod_getversion more than once + return + fi + if [ -h ${KERNEL_DIR} ] ; then einfo "${KERNEL_DIR} is a symbolic link" einfo "Determining the real directory of the Linux kernel source code" @@ -87,9 +93,9 @@ kernel-mod_getversion () kernel-mod_configoption_present () { - [ -e "${KERNEL_DIR}/.config" ] || die "kernel has not been configured yet" + [ -e "${KERNEL_DIR}/.config" ] || die "kernel has not been configured yet" - if egrep "^CONFIG_${1}=[ym]" ${ROOT}/usr/src/linux/.config >/dev/null + if egrep "^CONFIG_${1}=[ym]" ${KERNEL_DIR}/.config >/dev/null then return 0 else @@ -101,7 +107,7 @@ kernel-mod_configoption_module () { [ -e "${KERNEL_DIR}/.config" ] || die "kernel has not been configured yet" - if egrep "^CONFIG_${1}=[m]" ${ROOT}/usr/src/linux/.config >/dev/null + if egrep "^CONFIG_${1}=[m]" ${KERNEL_DIR}/.config >/dev/null then return 0 else @@ -113,7 +119,7 @@ kernel-mod_configoption_builtin () { [ -e "${KERNEL_DIR}/.config" ] || die "kernel has not been configured yet" - if egrep "^CONFIG_${1}=[y]" ${ROOT}/usr/src/linux/.config >/dev/null + if egrep "^CONFIG_${1}=[y]" ${KERNEL_DIR}/.config >/dev/null then return 0 else @@ -163,7 +169,7 @@ kernel-mod_checkzlibinflate_configured ( LINENO_START="`head -n $LINENO_END ${KERNEL_DIR}/lib/Config.in | grep -n 'if \[' | tail -n 1 | cut -d : -f 1`" (( LINENO_AMOUNT = $LINENO_END - $LINENO_START )) (( LINENO_END = $LINENO_END - 1 )) - + SYMBOLS="`head -n $LINENO_END ${KERNEL_DIR}/lib/Config.in | tail -n $LINENO_AMOUNT | sed -e 's/^.*\(CONFIG_[^\" ]*\).*/\1/g;'`" # okay, now we have a list of symbols @@ -210,34 +216,54 @@ kernel-mod_src_compile () kernel-mod_is_2_4_kernel() { kernel-mod_getversion - if [ "${KV_MAJOR}" -eq 2 -a "${KV_MINOR}" -eq 4 ] - then - return 0 - else - return 1 - fi + if [ "${KV_MAJOR}" -eq 2 -a "${KV_MINOR}" -eq 4 ] + then + return 0 + else + return 1 + fi } kernel-mod_is_2_5_kernel() { kernel-mod_getversion - if [ "${KV_MAJOR}" -eq 2 -a "${KV_MINOR}" -eq 5 ] - then - return 0 - else - return 1 - fi + if [ "${KV_MAJOR}" -eq 2 -a "${KV_MINOR}" -eq 5 ] + then + return 0 + else + return 1 + fi } kernel-mod_is_2_6_kernel() { kernel-mod_getversion - if [ "${KV_MAJOR}" -eq 2 -a "${KV_MINOR}" -eq 6 ] - then - return 0 - else - return 1 - fi + if [ "${KV_MAJOR}" -eq 2 -a "${KV_MINOR}" -eq 6 ] + then + return 0 + else + return 1 + fi +} + +kernel-mod_depmod() { + kernel-mod_getversion + + einfo "Updating module dependencies for kernel ${KV_VERSION_FULL}..." + + if [ -r ${KERNEL_DIR}/System.map ] + then + depmod -ae -F ${KERNEL_DIR}/System.map -b ${ROOT} -r ${KV_VERSION_FULL} + else + ewarn + ewarn "${KERNEL_DIR}/System.map not found." + ewarn "You must manually update the kernel module dependencies using depmod." + ewarn + fi +} + +kernel-mod_pkg_postinst() { + kernel-mod_depmod } -EXPORT_FUNCTIONS src_compile +EXPORT_FUNCTIONS src_compile pkg_postinst