summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-10-25 23:55:43 +0000
committerMike Frysinger <vapier@gentoo.org>2008-10-25 23:55:43 +0000
commit07c509b0ed67f18ad41ff725aab7b4823cc94adb (patch)
tree61af8954d2e6e87201f24cdd6c8ca939926d46c6 /sys-apps/module-init-tools
parentUpdating package.mask for openttd so it block only versions suffering from se... (diff)
downloadhistorical-07c509b0ed67f18ad41ff725aab7b4823cc94adb.tar.gz
historical-07c509b0ed67f18ad41ff725aab7b4823cc94adb.tar.bz2
historical-07c509b0ed67f18ad41ff725aab7b4823cc94adb.zip
Version bump #244196 by Lars (Polynomial-C). Also make sure we do not generate /etc/modprobe.conf if we dont need to.
Package-Manager: portage-2.2_rc12/cvs/Linux 2.6.26.2 x86_64
Diffstat (limited to 'sys-apps/module-init-tools')
-rw-r--r--sys-apps/module-init-tools/ChangeLog9
-rw-r--r--sys-apps/module-init-tools/Manifest13
-rwxr-xr-xsys-apps/module-init-tools/files/update-modules-3.5.sh395
-rw-r--r--sys-apps/module-init-tools/module-init-tools-3.5.ebuild165
4 files changed, 576 insertions, 6 deletions
diff --git a/sys-apps/module-init-tools/ChangeLog b/sys-apps/module-init-tools/ChangeLog
index 00ee31e45e6d..82b53d6274e1 100644
--- a/sys-apps/module-init-tools/ChangeLog
+++ b/sys-apps/module-init-tools/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for sys-apps/module-init-tools
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/module-init-tools/ChangeLog,v 1.137 2008/03/19 02:09:09 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/module-init-tools/ChangeLog,v 1.138 2008/10/25 23:55:43 vapier Exp $
+
+*module-init-tools-3.5 (25 Oct 2008)
+
+ 25 Oct 2008; Mike Frysinger <vapier@gentoo.org>
+ +files/update-modules-3.5.sh, +module-init-tools-3.5.ebuild:
+ Version bump #244196 by Lars (Polynomial-C). Also make sure we do not
+ generate /etc/modprobe.conf if we dont need to.
*module-init-tools-3.4-r1 (19 Mar 2008)
diff --git a/sys-apps/module-init-tools/Manifest b/sys-apps/module-init-tools/Manifest
index 3ec6a6317ef1..cc911dce8fc3 100644
--- a/sys-apps/module-init-tools/Manifest
+++ b/sys-apps/module-init-tools/Manifest
@@ -12,20 +12,23 @@ AUX modutils-2.4.27-hppa.patch 302 RMD160 15c0b2aadee725ef21370c9f016da6c74b882b
AUX modutils-2.4.27-no-nested-function.patch 1422 RMD160 6c34f6ff25019884495c21af525e88a63e449b3c SHA1 17eeaddba0fc3e476138a05d570eb79ab77b67ed SHA256 3e9961a7c9411e8c01eb48d9053d7901ec7a90ee0e070e85bd766385f36d563d
AUX update-modules 11529 RMD160 f4ff9435a4ff40cbb7e24aae5a4c3c77b9302789 SHA1 d91933f8aa35d77961ff8f7eb90736c2f19f67bd SHA256 0fc8fa66a87790a9d411a2a282600b36ada09b230a70d164d1c1e9bd2850ee66
AUX update-modules-3.4.sh 10380 RMD160 82ba9eef6970acbe88ef3a3eb3431a35e80fe111 SHA1 eaf50bac5ce0737a64b109a78137db1780916091 SHA256 f6cd3acd0d26570ac043f600b9705bfdc5c6b4b0d331c5c713c98f5b18ed829e
+AUX update-modules-3.5.sh 10519 RMD160 16c6c32397aa0e063e12cdd79efc81d02bcd2133 SHA1 3d5e2ae0f23b35147b38ec26c3377d2b697969c0 SHA256 b8866f643d369569de040b89c997b6a864ec3f0767a5e86b78d4b0badaa267c9
AUX update-modules.8 3210 RMD160 6d82ea356c1751ad46cf1c30e0fe237e7a4f50f2 SHA1 ed64791ca8e3215ee8a98784326f5d1c8a60bfd4 SHA256 4e352ee28ecaf79fac2a0216b8b4b52ced864cd258752f33213d1ac8f4a5849c
DIST module-init-tools-3.2.2.tar.bz2 169182 RMD160 42abfe10709315180898106e3c7c1ce916e01166 SHA1 b51e8ac170be23a1f2e301a1dddd47a47ec2186a SHA256 c080f7e42e60456eab33051026da388b5d21a360e9d2bee26ce9991427a758aa
DIST module-init-tools-3.4-manpages.tar.bz2 8819 RMD160 2d8e413dc0c85504494ef57508b0886ada487c03 SHA1 7c2d0d86391c4dfa8569f8fcf21cf3334dc323f5 SHA256 d26c038aa95d791436ce106a6b888d6487f0d9a47eb2962b1819ca1c1f112d4a
DIST module-init-tools-3.4.tar.bz2 190437 RMD160 07ccb9043240e1499ad99557ce223a007751f13e SHA1 fcdf758d171211b72210d48b7303ccb5651a1850 SHA256 96c7a1b313722a5203d7a6c4cb89f09ac186f8565bb1666a6053979072633d87
+DIST module-init-tools-3.5.tar.bz2 212177 RMD160 a49dda7ea6545dc91f6156930572150841743744 SHA1 86289ccafc47c0f1dde0955fda1922cdcc79ae9f SHA256 842496eae31ccd1334cd548f93d90180ca4f6c2cdde411e13c606bebe9f8cbea
DIST modutils-2.4.27.tar.bz2 234963 RMD160 3179d364106859cf6dbd1fad82d8356337634735 SHA1 fa268b48d98e0efab349d45fa7fb2372d58320c1 SHA256 ab4c9191645f9ffb455ae7c014d8c45339c13a1d0f6914817cfbf30a0bc56bf0
EBUILD module-init-tools-3.2.2-r3.ebuild 5306 RMD160 6a6f8cda50689d90bf746aa486e07bb1d0e4edc9 SHA1 40ae34059f69c9fd0ccf05b9483b7e99d9799332 SHA256 fde539909f359a3370a8020529129129e85b4a2cab53d6c5273ae03c678d0667
EBUILD module-init-tools-3.4-r1.ebuild 5315 RMD160 676601ab4f420425995b03f66e07673a9f095056 SHA1 2b8049b6d722ac57f62c383735981fd4811cc416 SHA256 feeb1696eb4f596ba5d616b732142f5abd8c90abdc9ad0f37345c03eeb40b47f
EBUILD module-init-tools-3.4.ebuild 5242 RMD160 c2d3732a931042553a4cd3af8a1a8339efa9f9a9 SHA1 3858328b3fb4cf1b30c10aafbe50a34272019937 SHA256 cc7dad37cd8de65e834faf99391879f321d61cc67b91ac9992d89cae6ef2cfed
-MISC ChangeLog 24155 RMD160 91dfdfd459f6fe2d2cb159c78520201174d634fb SHA1 8338abc058084006af7707019ed5e90ae76e6131 SHA256 d4ba4436e31f6e9c020e037550ac56cf3a4d5db9d1e1aab4c08d9329ce410e0c
+EBUILD module-init-tools-3.5.ebuild 5225 RMD160 962d28b1d43b20be543694ec79d27fb97b624387 SHA1 86d25a020f3c7f8e6548e50af124476b1d027faf SHA256 1f44d7778627385511d2bc850d5af4242cd0d88844a973f99ad71007acd17850
+MISC ChangeLog 24429 RMD160 c845861e2a407fac80f72f542e25f6220aab97af SHA1 79dbd352409df0fa985970d54b52cc5ab9f4acf3 SHA256 5f67ef44495b7de8b3945ec34e07675337f56fefa3d0c27ff06a4e0b5bf5ef10
MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.7 (GNU/Linux)
+Version: GnuPG v2.0.9 (GNU/Linux)
-iD8DBQFH4Lcqj9hvisErhMIRAkdlAKCloMLOueRo/5tAIHBo7VAAA9pWpQCaAtAL
-J0a1g/Xs3DMdsGoYj4sTxpg=
-=RYvV
+iEYEARECAAYFAkkDsgYACgkQ67wieSYcaxcFmgCgyBsREsZgnNmWP+houV6wPBTS
+CG8AoJ81IQaOEbttiS5dYk4BmlX6QgNp
+=zO7w
-----END PGP SIGNATURE-----
diff --git a/sys-apps/module-init-tools/files/update-modules-3.5.sh b/sys-apps/module-init-tools/files/update-modules-3.5.sh
new file mode 100755
index 000000000000..206521ce8a48
--- /dev/null
+++ b/sys-apps/module-init-tools/files/update-modules-3.5.sh
@@ -0,0 +1,395 @@
+#!/bin/bash
+# vim:ts=4
+# Distributed under the terms of the GNU General Public License v2
+#
+# This script will do:
+# - create /etc/modules.conf from /etc/modules.d/*
+# - create /etc/modprobe.conf from /etc/modprobe.d/*
+# - update modules.dep if modules.conf has been updated so depmod doesnt whine
+#
+# This is all for backwards compatibility. In the perfect world, we would be
+# running a linux-2.6 kernel and not have any modules.d directory. Then there
+# would be no work for us as module-init-tools automatically scans modprobe.d.
+# Until that happens, we'll keep scanning and warning and being a pita.
+#
+
+
+ROOT="${ROOT%/}/"
+[ "${ROOT}" = "${ROOT#/}" ] && ROOT="${PWD}/${ROOT}"
+cd "${ROOT}"
+
+argv0=${0##*/}
+. /etc/init.d/functions.sh || {
+ echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+ exit 1
+}
+umask 022
+esyslog() { :; }
+export PATH=/sbin:${PATH}
+
+[ "${argv0}" = "modules-update" ] && ewarn "Please run 'update-modules' from now on; 'modules-update' is going away"
+
+
+#
+# Setup some variables
+#
+
+HEADER="### This file is automatically generated by update-modules"
+
+#
+# Parse command-line
+#
+
+VERBOSE=0
+DEBUG=0
+FORCE="false"
+BACKUP="false"
+KV=
+while [ -n "$1" ] ; do
+ case $1 in
+ --assume-kernel=*) KV=${1#*=};;
+ -b|--backup) BACKUP="true";;
+ -f|--force|force) FORCE="true";;
+ -v|--verbose) ((VERBOSE+=1));;
+ -d|--debug) ((DEBUG+=1));;
+ -V|--version) exec echo "${argv0}$Revision: 1.1 $ $Date: 2008/10/25 23:55:43 $";;
+ -h|--help)
+ cat <<-EOF
+ Usage: update-modules [options]
+
+ Options:
+ --assume-kernel=KV Assume the kernel is at least version KV
+ -b, --backup Backup existing config files (add .old ext)
+ -f, --force Force execution in face of bad things
+ -v, --verbose Be a bit more verbose in what we do
+ -d, --debug Helpful debug output
+ -V, --version Dump version info
+ -h, --help This help screen, duh
+ EOF
+ exit 0
+ ;;
+ *)
+ eerror "Error: I don't understand $1"
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+if [ ! -w ./etc ] ; then
+ eerror "You must be root to do this"
+ exit 2
+fi
+
+[ ${DEBUG} -gt 0 ] && set -x
+
+veinfo() { [ ${VERBOSE} -gt 0 ] && einfo "$*" ; return 0 ; }
+vewarn() { [ ${VERBOSE} -gt 0 ] && ewarn "$*" ; return 0 ; }
+
+[ "${ROOT}" != "/" ] && veinfo "Operating on ROOT = '${ROOT}'"
+
+#
+# Let's check the optimal case first: nothing to do
+#
+if ! ${FORCE} ; then
+ if [ ! -d "./etc/modules.d" ] ; then
+ if [ ! -d "./etc/modprobe.d" ] ; then
+ veinfo "No /etc/modules.d or /etc/modprobe.d dir; Nothing to do!"
+ exit 0
+
+ elif [ -e "./etc/modprobe.conf" ] ; then
+ vewarn "You should put settings in /etc/modprobe.d/ rather than modprobe.conf"
+
+ elif [ -e "./etc/modules.conf" ] ; then
+ vewarn "If you only run linux-2.4, you should delete /etc/modules.conf"
+
+ else
+ veinfo "We have just /etc/modprobe.d; Nothing to do!"
+ exit 0
+ fi
+ else
+ vewarn "You have /etc/modules.d, so things need to get coalesced"
+ fi
+fi
+
+#
+# Build list of config files to generate and verify none
+# have been modified in any way
+#
+for x in modprobe.conf modules.conf ; do
+ x="./etc/${x}"
+ [ -r ${x} ] || continue
+
+ if [ "$(sed -ne 1p ${x})" != "${HEADER}" ] ; then
+ ewarn "Warning: ${x#.} has not been automatically generated"
+
+ if ${FORCE} ; then
+ ewarn "--force specified, (re)generating file anyway"
+ else
+ eerror "Use \"update-modules force\" to force (re)generation"
+ exit 1
+ fi
+ fi
+done
+
+
+#
+# If the system doesnt have old modutils, then this is prob linux-2.6 only
+#
+if type -P modprobe.old > /dev/null || \
+ LC_ALL=C modprobe -V 2>/dev/null | grep -qs "modprobe version"
+then
+ GENERATE_OLD="true"
+else
+ GENERATE_OLD="false"
+fi
+
+
+# Reset the sorting order since we depend on it
+export LC_COLLATE="C"
+
+KV=${KV:-$(uname -r)}
+
+
+#
+# Desc: backup a config file if need be and replace with new one
+# Usage: backup <old config file to backup> <new config file to replace with>
+# Ex: backup /etc/modules.conf /etc/modules.conf.tempfile
+#
+backup() {
+ if ${BACKUP} && [ -e "$1" ] ; then
+ mv -f "$1" "$1".old
+ fi
+ mv -f "$2" "$1"
+}
+
+
+#
+# Desc: Create module header
+# Usage: create_header <config dir>
+# Ex: create_header /etc/modules.d
+create_header() {
+ local moddir=$1
+
+ cat <<-EOF
+ ${HEADER}
+ #
+ # Please do not edit this file directly. If you want to change or add
+ # anything please take a look at the files in ${moddir} and read
+ # the manpage for update-modules(8).
+ #
+ EOF
+}
+
+
+#
+# Desc: Combine all config files in a dir and place output in a file
+# Usage: generate_config <output config file> <config dir> <reference config dir> <silent>
+# Ex: generate_config /etc/modules.conf /etc/modules.d
+#
+generate_config() {
+ local config=$1
+ local moddir=$2
+ local refdir=$3
+ local silent=$4
+ local tmpfile="${config}.$$"
+
+ [ -z "${silent}" ] && ebegin "Updating ${config#./etc/}"
+
+ create_header ${refdir:-${moddir}} > "${tmpfile}"
+
+ for cfg in "${moddir}"/* ; do
+ [ -d "${cfg}" ] && continue
+ [ ! -r "${cfg}" ] && continue
+
+ # Skip backup and RCS files #20597
+ case ${cfg} in *~|*.bak|*,v) continue;; esac
+
+ # If config file is found in the reference dir, then skip it
+ [ -n "${refdir}" ] && [ -e "${refdir}/${cfg##*/}" ] && continue
+
+ (
+ echo "### update-modules: start processing ${cfg#.}"
+ if [ -x "${cfg}" ] ; then
+ # $cfg can be executable; nice touch, Wichert! :)
+ "${cfg}"
+ else
+ cat "${cfg}"
+ fi
+ echo
+ echo "### update-modules: end processing ${cfg#.}"
+ echo
+ ) >> "${tmpfile}"
+ done
+
+ backup "${config}" "${tmpfile}"
+
+ [ -z "${silent}" ] && eend 0
+
+ return 0
+}
+
+
+#
+# Generate the old modules.conf file based upon all the snippets in
+# modules.d. Since modprobe doesnt handle modules.d, we need to gather
+# the files together in modules.conf for it.
+#
+
+if [ ! -d "./etc/modules.d" ] ; then
+ veinfo "No need to generate modules.conf :)"
+
+elif ${FORCE} || is_older_than ./etc/modules.conf ./etc/modules.d ; then
+ generate_config ./etc/modules.conf ./etc/modules.d
+
+else
+ veinfo "modules.conf: already up-to-date wheatness"
+fi
+
+#
+# Call depmod to keep insmod from complaining that modules.conf is more
+# recent then the modules.dep file.
+#
+if [ -e "./etc/modules.conf" ] ; then
+ depfile=$(
+ # the modules.conf file has optional syntax:
+ # depfile=/path/to/modules.dep
+ ret=$(sed -n -e '/^[[:space:]]*depfile=/s:.*=::p' ./etc/modules.conf)
+ eval echo "${ret:-/lib/modules/${KV}/modules.dep}"
+ )
+
+ if [ -d "${depfile%/*}" ] ; then
+ if [ ./etc/modules.conf -nt "${depfile}" ] ; then
+ arch=$(uname -m)
+ ebegin "Updating modules.dep"
+ for cfg in /lib/modules/${KV}/build /usr/src/linux-${KV} \
+ /lib/modules/${KV} /boot /usr/src/linux ""
+ do
+ cfg=".${cfg}/System.map"
+ for suffix in -genkernel-${arch}-${KV} -genkernel-'*'-${KV} -${KV} "" ; do
+ scfg=$(echo ${cfg}${suffix})
+ scfg=${scfg%% *}
+ [ -f "${scfg}" ] && cfg=${scfg} && break 2
+ done
+ cfg=""
+ done
+ [ -n "${cfg}" ] && cfg="-F ${cfg}"
+ depmod -b "${ROOT}" -a ${cfg} ${KV}
+ eend $?
+ veinfo "Ran: depmod -b '${ROOT}' -a ${cfg} ${KV}"
+ else
+ veinfo "modules.dep: already up-to-date goodness"
+ fi
+ else
+ vewarn "The dir '${depfile}' does not exist, skipping call to depmod"
+ fi
+fi
+
+
+#
+# Generate the new modprobe.conf file if possible. What this entails is
+# grabbing details from the old modprobe via the -c option and sticking
+# it in the newer config file. This is useful for backwards compat support
+# and for packages that provide older style /etc/modules.d/ files but not
+# newer style /etc/modprobe.d/ files.
+#
+# First we try to use the script `generate-modprobe.conf` from the
+# module-init-tools and if that fails us, we try and generate modprobe.conf
+# ourselves from the /etc/modules.d/ files.
+#
+if ! type -P generate-modprobe.conf > /dev/null ; then
+ vewarn "Skipping /etc/modprobe.conf generation (generate-modprobe.conf doesn't exist)"
+
+elif ! ${FORCE} && ! is_older_than ./etc/modprobe.conf ./etc/modules.d ./etc/modprobe.d ; then
+ veinfo "modprobe.conf: already up-to-date nutness"
+
+elif [ ! -e ./etc/modules.conf -a ! -e ./etc/modules.d ] ; then
+ veinfo "No need to generate modprobe.conf :)"
+ rm -f ./etc/modprobe.conf
+
+else
+ #
+ # First, bitch like crazy
+ #
+ for f in ./etc/modules.d/* ; do
+ # hack: ignore baselayout ;x
+ case ${f##*/} in
+ aliases|i386) continue;;
+ esac
+ [ -e "${f}" ] || continue
+ if [ ! -e "./etc/modprobe.d/${f##*/}" ] ; then
+ ewarn "Please file a bug about ${f#.}: it needs an /etc/modprobe.d/${f##*/}"
+ fi
+ done
+
+ generated_ok=0
+ tmpfile="./etc/modprobe.conf.$$"
+
+ #
+ # First we try to use regular generate-modprobe.conf
+ #
+ if ${GENERATE_OLD} ; then
+ ebegin "Updating modprobe.conf"
+ create_header /etc/modprobe.d > "${tmpfile}"
+ if generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \
+ >> "${tmpfile}" 2> "${tmpfile}.err"
+ then
+ backup "./etc/modprobe.conf" "${tmpfile}"
+ eend 0
+ generated_ok=1
+ else
+ [[ ${VERBOSE} -gt 0 ]] && cat "${tmpfile}.err"
+ eend 1 "Warning: could not generate /etc/modprobe.conf!"
+ fi
+ fi
+
+ #
+ # If the helper script failed, we fall back to doing it by hand
+ #
+ if [[ ${generated_ok} -eq 0 ]] ; then
+ ebegin "Updating modprobe.conf by hand"
+
+ generate_config ./etc/modprobe.conf ./etc/modules.d ./etc/modprobe.d 0
+ create_header /etc/modprobe.d > "${tmpfile}"
+
+ # Just use generate-modprobe.conf to filter compatible syntax
+ if TESTING_MODPROBE_CONF=./etc/modprobe.conf \
+ generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \
+ >> "${tmpfile}" 2> "${tmpfile}.err"
+ then
+ # we use mv here instead of backup_config() as the call to
+ # generate_config() above already took care of the backup
+ mv -f "${tmpfile}" "./etc/modprobe.conf"
+ eend $?
+ else
+ [[ ${VERBOSE} -gt 0 ]] && cat "${tmpfile}.err"
+ eend 1 "Warning: could not generate /etc/modprobe.conf!"
+ fi
+ fi
+
+ #
+ # Now append all the new files ... modprobe will not scan /etc/modprobe.d/
+ # if /etc/modprobe.conf exists, so we need to append /etc/modprobe.conf with
+ # /etc/modprobe.d/* ... http://bugs.gentoo.org/145962
+ #
+ if [[ -e ./etc/modprobe.conf ]] ; then
+ for cfg in ./etc/modprobe.d/* ; do
+ [ -d "${cfg}" ] && continue
+ [ ! -r "${cfg}" ] && continue
+
+ # Skip backup and RCS files #20597
+ case ${cfg} in *~|*.bak|*,v) continue;; esac
+
+ (
+ echo
+ echo "### update-modules: start processing ${cfg#.}"
+ cat "${cfg}"
+ echo "### update-modules: end processing ${cfg#.}"
+ ) >> "./etc/modprobe.conf"
+ done
+ fi
+
+ rm -f "${tmpfile}" "${tmpfile}.err"
+fi
+
+: # make sure we fall through with 0 exit status
diff --git a/sys-apps/module-init-tools/module-init-tools-3.5.ebuild b/sys-apps/module-init-tools/module-init-tools-3.5.ebuild
new file mode 100644
index 000000000000..30efdc1a377c
--- /dev/null
+++ b/sys-apps/module-init-tools/module-init-tools-3.5.ebuild
@@ -0,0 +1,165 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/module-init-tools/module-init-tools-3.5.ebuild,v 1.1 2008/10/25 23:55:43 vapier Exp $
+
+inherit flag-o-matic eutils toolchain-funcs fixheadtails
+
+MODUTILS_PV="2.4.27"
+
+MY_P="${P/_pre/-pre}"
+DESCRIPTION="tools for managing linux kernel modules"
+HOMEPAGE="http://kerneltools.org/"
+SRC_URI="mirror://kernel/linux/utils/kernel/module-init-tools/${MY_P}.tar.bz2
+ old-linux? ( mirror://kernel/linux/utils/kernel/modutils/v2.4/modutils-${MODUTILS_PV}.tar.bz2 )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="old-linux"
+# The test code runs `make clean && configure` and screws up src_compile()
+RESTRICT="test"
+
+DEPEND="sys-libs/zlib
+ >=sys-apps/baselayout-1.12.7-r2
+ !virtual/modutils"
+PROVIDE="virtual/modutils"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${A}
+
+ # Patches for old modutils
+ if use old-linux ; then
+ cd "${WORKDIR}"/modutils-${MODUTILS_PV}
+ epatch "${FILESDIR}"/modutils-2.4.27-alias.patch
+ epatch "${FILESDIR}"/modutils-2.4.27-gcc.patch
+ epatch "${FILESDIR}"/modutils-2.4.27-flex.patch
+ epatch "${FILESDIR}"/modutils-2.4.27-no-nested-function.patch
+ epatch "${FILESDIR}"/modutils-2.4.27-hppa.patch
+ epatch "${FILESDIR}"/modutils-2.4.27-build.patch #154281
+ fi
+
+ # Fixes for new module-init-tools
+ cd "${S}"
+ ht_fix_file tests/test-depmod/10badcommand.sh
+ # Test fails due since it needs to write to /lib/modules so disable it
+ rm -f tests/test-depmod/01backcompat.sh
+
+ # Fix bug 49926: This patch allows generate-modprobe.conf to
+ # accept the --assume-kernel=x.x.x option for generating livecds.
+ # This is a companion to a patch in baselayout-1.9.0 which allows
+ # the same flag to modules-update.
+ epatch "${FILESDIR}"/${PN}-3.1_generate-modprobe-assume-kernel.patch
+
+ # Abort if we fail to run modprobe, bug #68689
+ epatch "${FILESDIR}"/${PN}-3.2_pre7-abort-on-modprobe-failure.patch
+
+ epatch "${FILESDIR}"/${PN}-3.2.2-handle-dupliate-aliases.patch #149426
+
+ # make sure we link dynamically with zlib; our zlib.so is in /lib vs
+ # /usr/lib so it's safe to link with. fixes ugly textrels as well.
+ sed -i \
+ -e 's:-Wl,-Bstatic -lz -Wl,-Bdynamic:-lz:' \
+ configure || die
+
+ # make sure we don't try to regen the manpages
+ touch *.5 *.8
+}
+
+src_compile() {
+ # Configure script uses BUILDCFLAGS for cross-compiles but this
+ # defaults to CFLAGS which can be bad mojo
+ export BUILDCFLAGS=-pipe
+ export BUILDCC=$(tc-getBUILD_CC)
+
+ if use old-linux ; then
+ einfo "Building modutils ..."
+ cd "${WORKDIR}"/modutils-${MODUTILS_PV}
+ econf \
+ --disable-strip \
+ --prefix=/ \
+ --enable-insmod-static \
+ --disable-zlib \
+ || die "econf failed"
+ emake || die "emake modutils failed"
+
+ einfo "Building module-init-tools ..."
+ cd "${S}"
+ fi
+
+ econf \
+ --prefix=/ \
+ --enable-zlib \
+ || die "econf failed"
+ emake || die "emake module-init-tools failed"
+}
+
+modutils_src_install() {
+ cd "${WORKDIR}"/modutils-${MODUTILS_PV}
+ einstall prefix="${D}" || die
+ docinto modutils-${MODUTILS_PV}
+ dodoc CREDITS ChangeLog NEWS README TODO
+
+ # remove man pages provided by the man-pages package now #124127
+ rm -r "${D}"/usr/share/man/man2
+
+ cd "${S}"
+ # This copies the old version of modutils to *.old so it still works
+ # with kernels <= 2.4; new versions will execve() the .old version if
+ # a 2.4 kernel is running...
+ # This code was borrowed from the module-init-tools Makefile
+ local runme f
+ for f in lsmod modprobe rmmod depmod insmod insmod.static modinfo ; do
+ if [[ -L ${D}/sbin/${f} ]] ; then
+ einfo "Moving symlink $f to ${f}.old"
+ #runme = the target of the symlink with a .old tagged on.
+ runme=$(ls -l "${D}"/sbin/${f} | sed 's/.* -> //').old
+ [[ ! -e ${D}/sbin/${runme} ]] || einfo "${D}/sbin/${runme} not found"
+ dosym ${runme} /sbin/${f} || die
+ elif [[ -e ${D}/sbin/${f} ]] ; then
+ einfo "Moving executable $f to ${f}.old"
+ fi
+ mv -f "${D}"/sbin/${f} "${D}"/sbin/${f}.old
+ done
+ # Move the man pages as well. We only do this for the man pages of the
+ # tools that module-init-tools will replace.
+ for f in "${D}"/usr/share/man/man8/{lsmod,modprobe,rmmod,depmod,insmod}.8
+ do
+ mv -f ${f} ${f%\.*}.old.${f##*\.}
+ done
+ # Fix the ksyms links #35601
+ for f in ksyms kallsyms ; do
+ dosym insmod.old /sbin/${f}
+ dosym insmod.static.old /sbin/${f}.static
+ done
+}
+
+src_install() {
+ use old-linux && modutils_src_install
+
+ cd "${S}"
+ emake install DESTDIR="${D}" || die
+ dosym modprobe.conf.5 /usr/share/man/man5/modprobe.d.5
+
+ # Install compat symlink
+ dosym ../bin/lsmod /sbin/lsmod
+ use old-linux && dosym ../sbin/insmod.old /bin/lsmod.old
+ # Install the modules.conf2modprobe.conf tool, so we can update
+ # modprobe.conf.
+ into /
+ dosbin "${S}"/generate-modprobe.conf || die
+ newsbin "${FILESDIR}"/update-modules-3.5.sh update-modules || die
+ doman "${FILESDIR}"/update-modules.8
+
+ doman *.[1-8]
+ docinto /
+ dodoc AUTHORS ChangeLog INSTALL NEWS README TODO
+}
+
+pkg_postinst() {
+ # cheat to keep users happy
+ if grep -qs modules-update "${ROOT}"/etc/init.d/modules ; then
+ sed -i 's:modules-update:update-modules:' "${ROOT}"/etc/init.d/modules
+ fi
+}