Index: modules-update =================================================================== RCS file: /home/cvsroot/gentoo-src/rc-scripts/sbin/modules-update,v --- modules-update 4 Aug 2003 20:12:25 -0000 1.8 +++ modules-update 5 May 2004 20:43:41 -0000 @@ -3,10 +3,14 @@ # This is the modules-update script for Debian GNU/Linux. # Written by Wichert Akkerman # Copyright (C) 1998, 1999 Software in the Public Interest - -# Modifications by Daniel Robbins , Gentoo Technologies, Inc. -# 02 Sep 2001 -- Removed "arch" stuff since I see no reason to have support for varying -# CPU architectures on a single system. +# +# Modifications by Daniel Robbins , Gentoo +# Technologies, Inc. 02 Sep 2001 -- Removed "arch" stuff since I see +# no reason to have support for varying CPU architectures on a single +# system. +# +# Updated by Aron Griffis to handle +# --assume-kernel argument for livecd building CFGFILE="/etc/modules.conf" TMPFILE="${CFGFILE}.$$" @@ -22,11 +26,27 @@ source /sbin/functions.sh -KERNEL_2_5="no" +# Parse command-line +FORCE=false +KV=$(uname -r) +while [ -n "$1" ]; do + case "$1" in + force) + FORCE=true ;; + --assume-kernel=*) + KV=${1#*=} ;; + *) + echo "Error: I don't understand $1" >&2 + exit 1 ;; + esac + shift +done -if [ "$(get_KV)" -ge "$(KV_to_int '2.5.48')" ] -then - KERNEL_2_5="yes" +# Set kernel version, either from --assume-kernel or uname -r +if [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.5.48) ]]; then + KERNEL_2_5=true +else + KERNEL_2_5=false fi set -e @@ -38,7 +58,7 @@ dep="`egrep '[[:space:]]*depfile' ${CFGFILE} | tail -n 1 | sed -e 's/depfile=//' -e 's,/[^/]*$,,'`" if [ -z "${dep}" ] then - dep="/lib/modules/$(uname -r)" + dep="/lib/modules/${KV}" fi echo "${dep}" @@ -46,8 +66,7 @@ CFGFILES="${CFGFILE}" -if [ "${KERNEL_2_5}" = "yes" ] -then +if ${KERNEL_2_5}; then CFGFILES="${CFGFILES} ${CFGFILE2} ${CFGFILE4}" fi @@ -59,12 +78,11 @@ then echo "Error: the current ${x} is not automatically generated." - if [ "$1" != "force" ] - then + if $FORCE; then + echo "force specified, (re)generating file anyway." + else echo "Use \"modules-update force\" to force (re)generation." exit 1 - else - echo "force specified, (re)generating file anyway." fi fi fi @@ -80,8 +98,7 @@ then cp -f "${CFGFILE}" "${CFGFILE}".old fi -if [ "${KERNEL_2_5}" = "yes" ] -then +if ${KERNEL_2_5}; then if [ -e "${CFGFILE2}" ] then cp -f "${CFGFILE2}" "${CFGFILE2}".old @@ -101,7 +118,7 @@ # the manpage for modules-update. # EOF -if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "yes" ] +if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ] then sed -e "s:the files in ${MODDIR}:${CFGFILE}:" \ "${TMPFILE}" > "${TMPFILE2}" @@ -138,9 +155,9 @@ mv -f "${TMPFILE}" "${CFGFILE}" -if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "yes" ] +if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ] then - if /sbin/generate-modprobe.conf >> "${TMPFILE2}" 2> /dev/null + if /sbin/generate-modprobe.conf --assume-kernel=${KV} >> "${TMPFILE2}" 2> /dev/null then mv -f "${TMPFILE2}" "${CFGFILE2}" else @@ -153,7 +170,7 @@ gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" > "${TMPFILE3}" export TESTING_MODPROBE_CONF="${TMPFILE3}" - if /sbin/generate-modprobe.conf >> "${TMPFILE4}" 2> /dev/null + if /sbin/generate-modprobe.conf --assume-kernel=${KV} >> "${TMPFILE4}" 2> /dev/null then mv -f "${TMPFILE4}" "${CFGFILE4}" @@ -172,7 +189,11 @@ # if [ -d "`depdir`" -a -f /proc/modules ] then - depmod -a + if [ -f /usr/src/linux/System.map ]; then + depmod -a -F /usr/src/linux/System.map ${KV} + else + depmod -a ${KV} + fi fi --- /sbin/generate-modprobe.conf.agriffis 2004-04-05 01:22:23.000000000 -0400 +++ /sbin/generate-modprobe.conf.agriffis 2004-05-05 13:06:10.000000000 -0400 @@ -1,20 +1,29 @@ -#! /bin/sh -e +#!/bin/bash # Naive shell script to translate modules.conf + defaults to modprobe.conf # Normal caveats apply, as with any machine translation. -if [ $# -gt 2 -o x"$1" = x--help ]; then - echo "Usage: $0 [--stdin] [modprobe.conf]" - echo " Converts your current modules setup to modprobe.conf." - echo " Don't trust it too much." - echo " Version 0.1" - exit 1 -fi +# Parse command-line STDIN= -if [ "$1" = "--stdin" ]; then - STDIN=1 - shift -fi +KV=`uname -r` +while [[ "$1" == --* ]]; do + case "$1" in + --assume-kernel=*) + KV=${1#*=} + ;; + --stdin) + STDIN=1 + ;; + *) + echo "Usage: $0 [--stdin] [--assume-kernel=n.n.n] [modprobe.conf]" + echo " Converts your current modules setup to modprobe.conf." + echo " Don't trust it too much." + echo " Version 0.1" + exit 1 + ;; + esac + shift +done # Set up output if specified. if [ $# -eq 1 ]; then exec > $1; fi @@ -221,7 +230,7 @@ ($0 $MODULE) ;; # Ignore default lines which are not required any more. - "path[boot]=/lib/modules/boot"|"path[toplevel]=/lib/modules/`uname -r`"|"path[toplevel]=/lib/modules/2.4"|"path[kernel]=/lib/modules/kernel"|"path[fs]=/lib/modules/fs"|"path[net]=/lib/modules/net"|"path[scsi]=/lib/modules/scsi"|"path[block]=/lib/modules/block"|"path[cdrom]=/lib/modules/cdrom"|"path[ipv4]=/lib/modules/ipv4"|"path[ipv6]=/lib/modules/ipv6"|"path[sound]=/lib/modules/sound"|"path[fc4]=/lib/modules/fc4"|"path[video]=/lib/modules/video"|"path[misc]=/lib/modules/misc"|"path[pcmcia]=/lib/modules/pcmcia"|"path[atm]=/lib/modules/atm"|"path[usb]=/lib/modules/usb"|"path[ide]=/lib/modules/ide"|"path[ieee1394]=/lib/modules/ieee1394"|"path[mtd]=/lib/modules/mtd"|"generic_stringfile=/lib/modules/`uname -r`/modules.generic_string"|"pcimapfile=/lib/modules/`uname -r`/modules.pcimap"|"isapnpmapfile=/lib/modules/`uname -r`/modules.isapnpmap"|"usbmapfile=/lib/modules/`uname -r`/modules.usbmap"|"parportmapfile=/lib/modules/`uname -r`/modules.parportmap"|"ieee1394mapfile=/lib/modules/`uname -r`/modules.ieee1394map"|"pnpbiosmapfile=/lib/modules/`uname -r`/modules.pnpbiosmap"|"depfile=/lib/modules/`uname -r`/modules.dep"|"persistdir=/var/lib/modules/persist") + "path[boot]=/lib/modules/boot"|"path[toplevel]=/lib/modules/$KV"|"path[toplevel]=/lib/modules/2.4"|"path[kernel]=/lib/modules/kernel"|"path[fs]=/lib/modules/fs"|"path[net]=/lib/modules/net"|"path[scsi]=/lib/modules/scsi"|"path[block]=/lib/modules/block"|"path[cdrom]=/lib/modules/cdrom"|"path[ipv4]=/lib/modules/ipv4"|"path[ipv6]=/lib/modules/ipv6"|"path[sound]=/lib/modules/sound"|"path[fc4]=/lib/modules/fc4"|"path[video]=/lib/modules/video"|"path[misc]=/lib/modules/misc"|"path[pcmcia]=/lib/modules/pcmcia"|"path[atm]=/lib/modules/atm"|"path[usb]=/lib/modules/usb"|"path[ide]=/lib/modules/ide"|"path[ieee1394]=/lib/modules/ieee1394"|"path[mtd]=/lib/modules/mtd"|"generic_stringfile=/lib/modules/$KV/modules.generic_string"|"pcimapfile=/lib/modules/$KV/modules.pcimap"|"isapnpmapfile=/lib/modules/$KV/modules.isapnpmap"|"usbmapfile=/lib/modules/$KV/modules.usbmap"|"parportmapfile=/lib/modules/$KV/modules.parportmap"|"ieee1394mapfile=/lib/modules/$KV/modules.ieee1394map"|"pnpbiosmapfile=/lib/modules/$KV/modules.pnpbiosmap"|"depfile=/lib/modules/$KV/modules.dep"|"persistdir=/var/lib/modules/persist") ;; # Ignore prune lines unless they end in .o or .ko, which would