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 |
|