Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 49926
Collapse All | Expand All

(-)modules-update (-22 / +43 lines)
Lines 3-12 Link Here
3
# This is the modules-update script for Debian GNU/Linux.
3
# This is the modules-update script for Debian GNU/Linux.
4
# Written by Wichert Akkerman <wakkerma@debian.org>
4
# Written by Wichert Akkerman <wakkerma@debian.org>
5
# Copyright (C) 1998, 1999 Software in the Public Interest
5
# Copyright (C) 1998, 1999 Software in the Public Interest
6
6
#
7
# Modifications by Daniel Robbins <drobbins@gentoo.org>, Gentoo Technologies, Inc.
7
# Modifications by Daniel Robbins <drobbins@gentoo.org>, Gentoo
8
# 02 Sep 2001 -- Removed "arch" stuff since I see no reason to have support for varying
8
# Technologies, Inc.  02 Sep 2001 -- Removed "arch" stuff since I see
9
# CPU architectures on a single system.
9
# no reason to have support for varying CPU architectures on a single
10
# system.
11
#
12
# Updated by Aron Griffis <agriffis@gentoo.org> to handle
13
# --assume-kernel argument for livecd building
10
14
11
CFGFILE="/etc/modules.conf"
15
CFGFILE="/etc/modules.conf"
12
TMPFILE="${CFGFILE}.$$"
16
TMPFILE="${CFGFILE}.$$"
Lines 22-32 Link Here
22
26
23
source /sbin/functions.sh
27
source /sbin/functions.sh
24
28
25
KERNEL_2_5="no"
29
# Parse command-line
30
FORCE=false
31
KV=$(uname -r)
32
while [ -n "$1" ]; do
33
	case "$1" in
34
		force) 
35
			FORCE=true ;;
36
		--assume-kernel=*) 
37
			KV=${1#*=} ;;
38
		*)
39
			echo "Error: I don't understand $1" >&2
40
			exit 1 ;;
41
	esac
42
	shift
43
done
26
44
27
if [ "$(get_KV)" -ge "$(KV_to_int '2.5.48')" ]
45
# Set kernel version, either from --assume-kernel or uname -r
28
then
46
if [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.5.48) ]]; then
29
	KERNEL_2_5="yes"
47
	KERNEL_2_5=true
48
else
49
	KERNEL_2_5=false
30
fi
50
fi
31
51
32
set -e
52
set -e
Lines 38-44 Link Here
38
	dep="`egrep '[[:space:]]*depfile' ${CFGFILE} | tail -n 1 | sed -e 's/depfile=//' -e 's,/[^/]*$,,'`"
58
	dep="`egrep '[[:space:]]*depfile' ${CFGFILE} | tail -n 1 | sed -e 's/depfile=//' -e 's,/[^/]*$,,'`"
39
	if [ -z "${dep}" ]
59
	if [ -z "${dep}" ]
40
	then
60
	then
41
	    dep="/lib/modules/$(uname -r)"
61
	    dep="/lib/modules/${KV}"
42
	fi
62
	fi
43
63
44
	echo "${dep}"
64
	echo "${dep}"
Lines 46-53 Link Here
46
66
47
CFGFILES="${CFGFILE}"
67
CFGFILES="${CFGFILE}"
48
68
49
if [ "${KERNEL_2_5}" = "yes" ]
69
if ${KERNEL_2_5}; then
50
then
51
	CFGFILES="${CFGFILES} ${CFGFILE2} ${CFGFILE4}"
70
	CFGFILES="${CFGFILES} ${CFGFILE2} ${CFGFILE4}"
52
fi
71
fi
53
72
Lines 59-70 Link Here
59
		then
78
		then
60
			echo "Error: the current ${x} is not automatically generated."
79
			echo "Error: the current ${x} is not automatically generated."
61
		
80
		
62
			if [ "$1" != "force" ]
81
			if $FORCE; then
63
			then
82
				echo "force specified, (re)generating file anyway."
83
			else
64
				echo "Use \"modules-update force\" to force (re)generation."
84
				echo "Use \"modules-update force\" to force (re)generation."
65
				exit 1
85
				exit 1
66
			else
67
				echo "force specified, (re)generating file anyway."
68
			fi
86
			fi
69
		fi
87
		fi
70
	fi
88
	fi
Lines 80-87 Link Here
80
then
98
then
81
	cp -f "${CFGFILE}" "${CFGFILE}".old
99
	cp -f "${CFGFILE}" "${CFGFILE}".old
82
fi
100
fi
83
if [ "${KERNEL_2_5}" = "yes" ]
101
if ${KERNEL_2_5}; then
84
then
85
	if [ -e "${CFGFILE2}" ]
102
	if [ -e "${CFGFILE2}" ]
86
	then
103
	then
87
		cp -f "${CFGFILE2}" "${CFGFILE2}".old
104
		cp -f "${CFGFILE2}" "${CFGFILE2}".old
Lines 101-107 Link Here
101
# the manpage for modules-update.
118
# the manpage for modules-update.
102
#
119
#
103
EOF
120
EOF
104
if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "yes" ]
121
if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ]
105
then
122
then
106
	sed -e "s:the files in ${MODDIR}:${CFGFILE}:" \
123
	sed -e "s:the files in ${MODDIR}:${CFGFILE}:" \
107
		"${TMPFILE}" > "${TMPFILE2}"
124
		"${TMPFILE}" > "${TMPFILE2}"
Lines 138-146 Link Here
138
155
139
mv -f "${TMPFILE}" "${CFGFILE}"
156
mv -f "${TMPFILE}" "${CFGFILE}"
140
157
141
if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "yes" ]
158
if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ]
142
then
159
then
143
	if /sbin/generate-modprobe.conf >> "${TMPFILE2}" 2> /dev/null
160
	if /sbin/generate-modprobe.conf --assume-kernel=${KV} >> "${TMPFILE2}" 2> /dev/null
144
	then
161
	then
145
		mv -f "${TMPFILE2}" "${CFGFILE2}"
162
		mv -f "${TMPFILE2}" "${CFGFILE2}"
146
	else
163
	else
Lines 153-159 Link Here
153
		gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" > "${TMPFILE3}"
170
		gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" > "${TMPFILE3}"
154
		
171
		
155
		export TESTING_MODPROBE_CONF="${TMPFILE3}"
172
		export TESTING_MODPROBE_CONF="${TMPFILE3}"
156
		if /sbin/generate-modprobe.conf >> "${TMPFILE4}" 2> /dev/null
173
		if /sbin/generate-modprobe.conf --assume-kernel=${KV} >> "${TMPFILE4}" 2> /dev/null
157
		then
174
		then
158
			mv -f "${TMPFILE4}" "${CFGFILE4}"
175
			mv -f "${TMPFILE4}" "${CFGFILE4}"
159
176
Lines 172-178 Link Here
172
#
189
#
173
if [ -d "`depdir`" -a -f /proc/modules ]
190
if [ -d "`depdir`" -a -f /proc/modules ]
174
then
191
then
175
	depmod -a
192
	if [ -f /usr/src/linux/System.map ]; then
193
		depmod -a -F /usr/src/linux/System.map ${KV}
194
	else
195
		depmod -a ${KV}
196
	fi
176
fi
197
fi
177
198
178
199
(-)/sbin/generate-modprobe.conf.agriffis (-13 / +22 lines)
Lines 1-20 Link Here
1
#! /bin/sh -e
1
#!/bin/bash
2
2
3
# Naive shell script to translate modules.conf + defaults to modprobe.conf
3
# Naive shell script to translate modules.conf + defaults to modprobe.conf
4
# Normal caveats apply, as with any machine translation.
4
# Normal caveats apply, as with any machine translation.
5
if [ $# -gt 2 -o x"$1" = x--help ]; then
6
    echo "Usage: $0 [--stdin] [modprobe.conf]"
7
    echo "   Converts your current modules setup to modprobe.conf."
8
    echo "   Don't trust it too much."
9
    echo " Version 0.1"
10
    exit 1
11
fi
12
5
6
# Parse command-line
13
STDIN=
7
STDIN=
14
if [ "$1" = "--stdin" ]; then
8
KV=`uname -r`
15
  STDIN=1
9
while [[ "$1" == --* ]]; do
16
  shift
10
    case "$1" in
17
fi
11
	--assume-kernel=*)
12
	    KV=${1#*=}
13
	    ;;
14
	--stdin)
15
	    STDIN=1
16
	    ;;
17
	*)
18
	    echo "Usage: $0 [--stdin] [--assume-kernel=n.n.n] [modprobe.conf]"
19
	    echo "   Converts your current modules setup to modprobe.conf."
20
	    echo "   Don't trust it too much."
21
	    echo " Version 0.1"
22
	    exit 1
23
	    ;;
24
    esac
25
    shift
26
done
18
27
19
# Set up output if specified.
28
# Set up output if specified.
20
if [ $# -eq 1 ]; then exec > $1; fi
29
if [ $# -eq 1 ]; then exec > $1; fi
Lines 221-227 Link Here
221
	($0 $MODULE)
230
	($0 $MODULE)
222
	;;
231
	;;
223
    # Ignore default lines which are not required any more.
232
    # Ignore default lines which are not required any more.
224
    "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")
233
    "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")
225
	;;
234
	;;
226
235
227
    # Ignore prune lines unless they end in .o or .ko, which would
236
    # Ignore prune lines unless they end in .o or .ko, which would

Return to bug 49926