Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 55329 | Differences between
and this patch

Collapse All | Expand All

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

Return to bug 55329