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

(-)modules-update.old (-85 / +120 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 dependencyChanged ${CFGFILE} "${MODDIR}" "${MODDIR}"/* "${CONF}" || $FORCE
98
then
99
then
99
	cp -f "${CFGFILE}" "${CFGFILE}".old
100
	echo "Generating ${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}"/* "${CONF}"
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
115
	
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
143
	
133
	
144
	if [ -x ${cfg} ]
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
fi
154
	echo >> "${TMPFILE}"
142
155
done
156
143
157
mv -f "${TMPFILE}" "${CFGFILE}"
158
144
159
if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ]
145
# this section generates ${CFGFILE2} if CFGFILE is newer
146
147
if [ "${CFGFILE}" -nt "${CFGFILE2}" ] || $FORCE 
160
then
148
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
149
180
	if [ -f "${CFGFILE3}" ]
150
	if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ]
181
	then
151
	then
182
		gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" \
152
		echo "Generating ${CFGFILE2}"
183
			> "${TMPFILE3}"
184
		
153
		
185
		export TESTING_MODPROBE_CONF="${TMPFILE3}"
154
		echo "${HEADER}" > "${TMPFILE2}"
155
		cat <<EOF >> "${TMPFILE2}"
156
#
157
# Please do not edit this file directly. If you want to change or add
158
# anything please take a look at ${CFGFILE} and read
159
# the manpage for modules-update.
160
#
161
EOF
162
		# Make sure that generate-modprobe.conf can handle --assume-kernel
163
		# if we were called with it.
164
		if [[ -n ${ASSUME_KV} ]] && ! grep -qe --assume-kernel \
165
			/sbin/generate-modprobe.conf
166
		then
167
			eerror "Error: modules-update called with --assume-kernel flag, but"
168
			eerror "generate-modprobe.conf doesn't understand it.  You need to"
169
			eerror "install >=module-init-tools-3.0-r2"
170
			exit 3
171
		fi
186
		if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \
172
		if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \
187
			>> "${TMPFILE4}" 2> /dev/null
173
			>> "${TMPFILE2}" 2> /dev/null
188
		then
174
		then
189
			mv -f "${TMPFILE4}" "${CFGFILE4}"
175
			# back up the current file
190
176
			if [ -e "${CFGFILE2}" ]
191
			echo >> "${CFGFILE4}"
177
			then
192
			echo "include /etc/modprobe.conf" >> "${CFGFILE4}"
178
				cp -f "${CFGFILE2}" "${CFGFILE2}".old
179
			fi
180
			mv -f "${TMPFILE2}" "${CFGFILE2}"
193
		else
181
		else
194
			ewarn "Warning: could not generate ${CFGFILE4}!"
182
			ewarn "Warning: could not generate ${CFGFILE2}!"
195
			rm -f "${TMPFILE4}"
183
			rm -f "${TMPFILE2}"
184
		fi
185
	fi
186
fi
187
188
189
if [ "${CFGFILE3}" -nt "${CFGFILE4}" ] || $FORCE 
190
then
191
192
	if [ -x /sbin/generate-modprobe.conf -a "${KERNEL_2_5}" = "true" ]
193
	then
194
		if [ -f "${CFGFILE3}" ]
195
		then
196
			echo "Generating ${CFGFILE4}"
197
			echo "${HEADER}" > "${TMPFILE4}"
198
			cat <<EOF >> "${TMPFILE4}"
199
#
200
# Please do not edit this file directly. If you want to change or add
201
# anything please take a look at ${CFGFILE3} and read
202
# the manpage for modules-update.
203
#
204
EOF
205
			
206
			gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" \
207
				> "${TMPFILE3}"
208
			
209
			export TESTING_MODPROBE_CONF="${TMPFILE3}"
210
			if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \
211
				>> "${TMPFILE4}" 2> /dev/null
212
			then
213
				echo >> "${TMPFILE4}"
214
				echo "include /etc/modprobe.conf" >> "${TMPFILE4}"
215
				
216
				# backup the current file
217
				if [ -e "${CFGFILE4}" ]
218
				then
219
					cp -f "${CFGFILE4}" "${CFGFILE4}".old
220
				fi
221
				
222
				mv -f "${TMPFILE4}" "${CFGFILE4}"
223
			else
224
				ewarn "Warning: could not generate ${CFGFILE4}!"
225
				rm -f "${TMPFILE4}"
226
			fi
227
			rm -f "${TMPFILE3}"
196
		fi
228
		fi
197
		rm -f "${TMPFILE3}"
198
	fi
229
	fi
199
fi
230
fi
200
231
201
# We also call depmod here to stop insmod from complaining that modules.conf
232
# We also call depmod here to stop insmod from complaining that modules.conf
202
# is more recent then modules.dep
233
# is more recent then modules.dep
203
#
234
#
204
if [ -d "`depdir`" -a -f /proc/modules ]
235
236
if [ "${CFGFILE2}" -nt /lib/modules/${KV}/modules.dep ] || $FORCE
205
then
237
then
206
	if [ -f /usr/src/linux/System.map ]; then
238
	if [ -d "`depdir`" -a -f /proc/modules ]
207
		depmod -a -F /usr/src/linux/System.map ${KV}
239
	then
208
	else
240
		echo "Generating /lib/modules/${KV}/modules.dep"
209
		depmod -a ${KV}
241
		if [ -f /usr/src/linux/System.map ]; then
242
			depmod -a -F /usr/src/linux/System.map ${KV}
243
		else
244
			depmod -a ${KV}
245
		fi
210
	fi
246
	fi
211
fi
247
fi
212
248
213
214
# vim:ts=4
249
# vim:ts=4
(-)functions.sh.old (+21 lines)
Lines 494-499 Link Here
494
	echo "${mylist}"
494
	echo "${mylist}"
495
}
495
}
496
496
497
# finds if any of the dependency files is newer than the target file
498
#
499
# int dependencyChanged(char * target, char ** dependencies)
500
#
501
#    return 0 if any dependency is newer than target
502
#
503
#    EXAMPLE: if dependencyChanged a.out *.o  ; then ...
504
# 
505
dependencyChanged() {
506
	local x=
507
	local target="$1"
508
	shift
509
	
510
	for x in "$@"
511
	do
512
		[ "${x}" -nt "${target}" ] && return 0
513
	done
514
	
515
	return 1
516
}
517
497
# void save_options(char *option, char *optstring)
518
# void save_options(char *option, char *optstring)
498
#
519
#
499
#    save the settings ("optstring") for "option"
520
#    save the settings ("optstring") for "option"

Return to bug 55329