/[baselayout]/branches/rc-scripts-1_6/sbin/modules-update
Gentoo

Diff of /branches/rc-scripts-1_6/sbin/modules-update

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1747 Revision 1748
22MODDIR="/etc/modules.d" 22MODDIR="/etc/modules.d"
23ARCHDIR="${MODDIR}/arch" 23ARCHDIR="${MODDIR}/arch"
24HEADER="### This file is automatically generated by modules-update" 24HEADER="### This file is automatically generated by modules-update"
25 25
26source /sbin/functions.sh 26source /sbin/functions.sh
27esyslog() { :; }
27 28
28# Parse command-line 29# Parse command-line
30VERBOSE=0
31DEBUG=0
29FORCE=false 32FORCE=false
30ASSUME_KV= 33ASSUME_KV=
31while [ -n "$1" ]; do 34while [ -n "$1" ]; do
32 case "$1" in 35 case "$1" in
33 force) 36 -f|--force|force)
34 FORCE=true ;; 37 FORCE=true ;;
35 --assume-kernel=*) 38 --assume-kernel=*)
36 ASSUME_KV=${1#*=} ;; 39 ASSUME_KV=${1#*=} ;;
40 -v|--verbose) ((++VERBOSE)) ;;
41 -d|--debug) DEBUG=1 ;;
42 -V|--version)
43 cat /etc/gentoo-release
44 exit 0 ;;
45 -h|--help)
46 cat <<-EOF
47 Usage: modules-update [options]
48
49 Options:
50 --assume-kernel=KV Assume the kernel is at least version KV
51 -f, --force Force execution in face of bad things
52 -v, --verbose Be a bit more verbose in what we do
53 -d, --debug Helpful debug output
54 -V, --version Dump version info
55 -h, --help This help screen, duh
56 EOF
57 exit 0
58 ;;
37 *) 59 *)
38 echo "Error: I don't understand $1" >&2 60 echo "Error: I don't understand $1" >&2
39 exit 1 ;; 61 exit 1 ;;
40 esac 62 esac
41 shift 63 shift
42done 64done
65
66[[ ${DEBUG} == "1" ]] && set -x
43 67
44# Set kernel version, either from --assume-kernel or uname -r 68# Set kernel version, either from --assume-kernel or uname -r
45KV=${ASSUME_KV:-$(uname -r)} 69KV=${ASSUME_KV:-$(uname -r)}
46if [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.5.48) ]]; then 70if [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.5.48) ]]; then
47 KERNEL_2_5=true 71 KERNEL_2_5=true
167 eerror "generate-modprobe.conf doesn't understand it. You need to" 191 eerror "generate-modprobe.conf doesn't understand it. You need to"
168 eerror "install >=module-init-tools-3.0-r2" 192 eerror "install >=module-init-tools-3.0-r2"
169 exit 3 193 exit 3
170 fi 194 fi
171 if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \ 195 if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \
172 >> "${TMPFILE2}" 2> /dev/null 196 >> "${TMPFILE2}" 2> "${TMPFILE2}.err"
173 then 197 then
174 mv -f "${TMPFILE2}" "${CFGFILE2}" 198 mv -f "${TMPFILE2}" "${CFGFILE2}"
175 else 199 else
200 [[ ${VERBOSE} -gt 0 ]] && cat "${TMPFILE2}.err"
176 ewarn "Warning: could not generate ${CFGFILE2}!" 201 ewarn "Warning: could not generate ${CFGFILE2}!"
177 rm -f "${TMPFILE2}" 202 rm -f "${TMPFILE2}"
178 fi 203 fi
204 rm -f "${TMPFILE2}.err"
179 205
180 if [ -f "${CFGFILE3}" ] 206 if [ -f "${CFGFILE3}" ]
181 then 207 then
182 gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" \ 208 gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" \
183 > "${TMPFILE3}" 209 > "${TMPFILE3}"
184 210
185 export TESTING_MODPROBE_CONF="${TMPFILE3}" 211 export TESTING_MODPROBE_CONF="${TMPFILE3}"
186 if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \ 212 if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \
187 >> "${TMPFILE4}" 2> /dev/null 213 >> "${TMPFILE4}" 2> "${TMPFILE4}.err"
188 then 214 then
189 mv -f "${TMPFILE4}" "${CFGFILE4}" 215 mv -f "${TMPFILE4}" "${CFGFILE4}"
190 216
191 echo >> "${CFGFILE4}" 217 echo >> "${CFGFILE4}"
192 echo "include /etc/modprobe.conf" >> "${CFGFILE4}" 218 echo "include /etc/modprobe.conf" >> "${CFGFILE4}"
193 else 219 else
220 [[ ${VERBOSE} -gt 0 ]] && cat "${TMPFILE4}.err"
194 ewarn "Warning: could not generate ${CFGFILE4}!" 221 ewarn "Warning: could not generate ${CFGFILE4}!"
195 rm -f "${TMPFILE4}" 222 rm -f "${TMPFILE4}"
196 fi 223 fi
197 rm -f "${TMPFILE3}" 224 rm -f "${TMPFILE3}" "${TMPFILE4}.err"
198 fi 225 fi
199fi 226fi
200 227
201# We also call depmod here to stop insmod from complaining that modules.conf 228# We also call depmod here to stop insmod from complaining that modules.conf
202# is more recent then modules.dep 229# is more recent then modules.dep

Legend:
Removed from v.1747  
changed lines
  Added in v.1748

  ViewVC Help
Powered by ViewVC 1.1.20