Lines 110-214
Link Here
|
110 |
fi |
110 |
fi |
111 |
|
111 |
|
112 |
|
112 |
|
113 |
echo "${HEADER}" > "${TMPFILE}" |
113 |
# this section generates ${CFGFILE} if needed |
114 |
cat <<EOF >> "${TMPFILE}" |
114 |
# first find out if there is a newer file in ${MODDIR}/* |
|
|
115 |
# so we know if this step is necesary |
116 |
newerfiles="$( |
117 |
for cfg in "${MODDIR}"/* "${CONF}" |
118 |
do |
119 |
if [ "${cfg}" -nt "${CFGFILE}" ] |
120 |
then |
121 |
echo "${cfg}" |
122 |
fi |
123 |
done |
124 |
)" |
125 |
|
126 |
if [ -n "${newerfiles}" ] || $FORCE |
127 |
then |
128 |
echo "Generating ${CFGFILE}" |
129 |
echo "${HEADER}" > "${TMPFILE}" |
130 |
cat <<EOF >> "${TMPFILE}" |
115 |
# |
131 |
# |
116 |
# Please do not edit this file directly. If you want to change or add |
132 |
# Please do not edit this file directly. If you want to change or add |
117 |
# anything please take a look at the files in ${MODDIR} and read |
133 |
# anything please take a look at the files in ${MODDIR} and read |
118 |
# the manpage for modules-update. |
134 |
# the manpage for modules-update. |
119 |
# |
135 |
# |
120 |
EOF |
136 |
EOF |
121 |
if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ] |
137 |
for cfg in "${MODDIR}"/* "${CONF}" |
122 |
then |
138 |
do |
123 |
sed -e "s:the files in ${MODDIR}:${CFGFILE}:" \ |
139 |
[ -d "${cfg}" ] && continue |
124 |
"${TMPFILE}" > "${TMPFILE2}" |
140 |
|
125 |
|
141 |
[ ! -r "${cfg}" ] && continue |
126 |
if [ -f "${CFGFILE3}" ] |
142 |
|
127 |
then |
143 |
# Skip backup and RCS files; fixes bug 20597 (07 May 2004 agriffis) |
128 |
sed -e "s:the files in ${MODDIR}:${CFGFILE3}:" \ |
144 |
[[ ${cfg} == *~ || ${cfg} == *.bak || ${cfg} == *,v ]] && continue |
129 |
"${TMPFILE}" > "${TMPFILE4}" |
145 |
|
130 |
fi |
146 |
echo "### modules-update: start processing ${cfg}" >> "${TMPFILE}" |
|
|
147 |
|
148 |
if [ -x ${cfg} ] |
149 |
then |
150 |
# $cfg can be executable; nice touch, Wichert! :) |
151 |
"${cfg}" >> "${TMPFILE}" |
152 |
else |
153 |
cat "${cfg}" >> "${TMPFILE}" |
154 |
fi |
155 |
|
156 |
echo >> "${TMPFILE}" |
157 |
echo "### modules-update: end processing ${cfg}" >> "${TMPFILE}" |
158 |
echo >> "${TMPFILE}" |
159 |
done |
160 |
|
161 |
mv -f "${TMPFILE}" "${CFGFILE}" |
131 |
fi |
162 |
fi |
132 |
|
163 |
|
133 |
for cfg in "${MODDIR}"/* "${CONF}" |
|
|
134 |
do |
135 |
[ -d "${cfg}" ] && continue |
136 |
|
164 |
|
137 |
[ ! -r "${cfg}" ] && continue |
|
|
138 |
|
165 |
|
139 |
# Skip backup and RCS files; fixes bug 20597 (07 May 2004 agriffis) |
166 |
# this section generates ${CFGFILE2} if CFGFILE is newer |
140 |
[[ ${cfg} == *~ || ${cfg} == *.bak || ${cfg} == *,v ]] && continue |
167 |
|
141 |
|
168 |
if [ "${CFGFILE}" -nt "${CFGFILE2}" ] || $FORCE |
142 |
echo "### modules-update: start processing ${cfg}" >> "${TMPFILE}" |
169 |
then |
143 |
|
170 |
|
144 |
if [ -x ${cfg} ] |
171 |
if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ] |
145 |
then |
172 |
then |
146 |
# $cfg can be executable; nice touch, Wichert! :) |
173 |
echo "Generating ${CFGFILE2}" |
147 |
"${cfg}" >> "${TMPFILE}" |
174 |
echo "${HEADER}" > "${TMPFILE2}" |
148 |
else |
175 |
cat <<EOF >> "${TMPFILE2}" |
149 |
cat "${cfg}" >> "${TMPFILE}" |
176 |
# |
|
|
177 |
# Please do not edit this file directly. If you want to change or add |
178 |
# anything please take a look at ${CFGFILE} and read |
179 |
# the manpage for modules-update. |
180 |
# |
181 |
EOF |
182 |
# Make sure that generate-modprobe.conf can handle --assume-kernel |
183 |
# if we were called with it. |
184 |
if [[ -n ${ASSUME_KV} ]] && ! grep -qe --assume-kernel \ |
185 |
/sbin/generate-modprobe.conf |
186 |
then |
187 |
eerror "Error: modules-update called with --assume-kernel flag, but" |
188 |
eerror "generate-modprobe.conf doesn't understand it. You need to" |
189 |
eerror "install >=module-init-tools-3.0-r2" |
190 |
exit 3 |
191 |
fi |
192 |
if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \ |
193 |
>> "${TMPFILE2}" 2> /dev/null |
194 |
then |
195 |
mv -f "${TMPFILE2}" "${CFGFILE2}" |
196 |
else |
197 |
ewarn "Warning: could not generate ${CFGFILE2}!" |
198 |
rm -f "${TMPFILE2}" |
199 |
fi |
150 |
fi |
200 |
fi |
151 |
|
201 |
fi |
152 |
echo >> "${TMPFILE}" |
|
|
153 |
echo "### modules-update: end processing ${cfg}" >> "${TMPFILE}" |
154 |
echo >> "${TMPFILE}" |
155 |
done |
156 |
|
202 |
|
157 |
mv -f "${TMPFILE}" "${CFGFILE}" |
|
|
158 |
|
203 |
|
159 |
if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ] |
204 |
if [ "${CFGFILE3}" -nt "${CFGFILE4}" ] || $FORCE |
160 |
then |
205 |
then |
161 |
# Make sure that generate-modprobe.conf can handle --assume-kernel |
|
|
162 |
# if we were called with it. |
163 |
if [[ -n ${ASSUME_KV} ]] && ! grep -qe --assume-kernel \ |
164 |
/sbin/generate-modprobe.conf |
165 |
then |
166 |
eerror "Error: modules-update called with --assume-kernel flag, but" |
167 |
eerror "generate-modprobe.conf doesn't understand it. You need to" |
168 |
eerror "install >=module-init-tools-3.0-r2" |
169 |
exit 3 |
170 |
fi |
171 |
if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \ |
172 |
>> "${TMPFILE2}" 2> /dev/null |
173 |
then |
174 |
mv -f "${TMPFILE2}" "${CFGFILE2}" |
175 |
else |
176 |
ewarn "Warning: could not generate ${CFGFILE2}!" |
177 |
rm -f "${TMPFILE2}" |
178 |
fi |
179 |
|
206 |
|
180 |
if [ -f "${CFGFILE3}" ] |
207 |
if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ] |
181 |
then |
208 |
then |
182 |
gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" \ |
209 |
if [ -f "${CFGFILE3}" ] |
183 |
> "${TMPFILE3}" |
|
|
184 |
|
185 |
export TESTING_MODPROBE_CONF="${TMPFILE3}" |
186 |
if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \ |
187 |
>> "${TMPFILE4}" 2> /dev/null |
188 |
then |
210 |
then |
189 |
mv -f "${TMPFILE4}" "${CFGFILE4}" |
211 |
echo "Generating ${CFGFILE4}" |
190 |
|
212 |
|
191 |
echo >> "${CFGFILE4}" |
213 |
echo "${HEADER}" > "${TMPFILE4}" |
192 |
echo "include /etc/modprobe.conf" >> "${CFGFILE4}" |
214 |
cat <<EOF >> "${TMPFILE4}" |
193 |
else |
215 |
# |
194 |
ewarn "Warning: could not generate ${CFGFILE4}!" |
216 |
# Please do not edit this file directly. If you want to change or add |
195 |
rm -f "${TMPFILE4}" |
217 |
# anything please take a look at ${CFGFILE3} and read |
|
|
218 |
# the manpage for modules-update. |
219 |
# |
220 |
EOF |
221 |
|
222 |
gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" \ |
223 |
> "${TMPFILE3}" |
224 |
|
225 |
export TESTING_MODPROBE_CONF="${TMPFILE3}" |
226 |
if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \ |
227 |
>> "${TMPFILE4}" 2> /dev/null |
228 |
then |
229 |
echo >> "${TMPFILE4}" |
230 |
echo "include /etc/modprobe.conf" >> "${TMPFILE4}" |
231 |
|
232 |
mv -f "${TMPFILE4}" "${CFGFILE4}" |
233 |
else |
234 |
ewarn "Warning: could not generate ${CFGFILE4}!" |
235 |
rm -f "${TMPFILE4}" |
236 |
fi |
237 |
rm -f "${TMPFILE3}" |
196 |
fi |
238 |
fi |
197 |
rm -f "${TMPFILE3}" |
|
|
198 |
fi |
239 |
fi |
199 |
fi |
240 |
fi |
200 |
|
241 |
|
201 |
# We also call depmod here to stop insmod from complaining that modules.conf |
242 |
# We also call depmod here to stop insmod from complaining that modules.conf |
202 |
# is more recent then modules.dep |
243 |
# is more recent then modules.dep |
203 |
# |
244 |
# |
204 |
if [ -d "`depdir`" -a -f /proc/modules ] |
245 |
|
|
|
246 |
if [ "${CFGFILE2}" -nt /lib/modules/${KV}/modules.dep ] || $FORCE |
205 |
then |
247 |
then |
206 |
if [ -f /usr/src/linux/System.map ]; then |
248 |
if [ -d "`depdir`" -a -f /proc/modules ] |
207 |
depmod -a -F /usr/src/linux/System.map ${KV} |
249 |
then |
208 |
else |
250 |
echo "Generating /lib/modules/${KV}/modules.dep" |
209 |
depmod -a ${KV} |
251 |
if [ -f /usr/src/linux/System.map ]; then |
|
|
252 |
depmod -a -F /usr/src/linux/System.map ${KV} |
253 |
else |
254 |
depmod -a ${KV} |
255 |
fi |
210 |
fi |
256 |
fi |
211 |
fi |
257 |
fi |
212 |
|
258 |
|
213 |
|
|
|
214 |
# vim:ts=4 |
259 |
# vim:ts=4 |