/[livecd-tools]/trunk/autoconfig
Gentoo

Diff of /trunk/autoconfig

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

Revision 107 Revision 109
1#!/sbin/runscript 1#!/sbin/runscript
2# Copyright 1999-2005 Gentoo Foundation 2# Copyright 1999-2005 Gentoo Foundation
3# Distributed under the terms of the GNU General Public License v2 3# Distributed under the terms of the GNU General Public License v2
4# $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.60 2006/06/16 16:25:20 wolf31o2 Exp $ 4# $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.61 2006/06/21 15:29:04 wolf31o2 Exp $
5 5
6DHCP="yes" 6DHCP="yes"
7DETECT="yes" 7DETECT="yes"
8GPM="yes" 8GPM="yes"
9PCMCIA="no" 9PCMCIA="no"
108 tar xjf /lib/firmware.tar.bz2 -C /lib/firmware 108 tar xjf /lib/firmware.tar.bz2 -C /lib/firmware
109 eend 0 109 eend 0
110 fi 110 fi
111} 111}
112 112
113# Only used on SGI CDs, this determines: 113get_info() {
114# A) CPU Type 114 local tmp
115# B) System 115
116 if [ ! -z "${1}" -a ! -z "${2}" ]
117 then
118 tmp=$(grep "^$1[[:space:]]\+:" /proc/cpuinfo | head -n 1 | cut -d" " -f3-)
119 eval "$2='${tmp}'"
120 fi
121}
122
116detect_mips() { 123detect_mips() {
117 local cpuinfo="$(awk -F: '/^cpu model/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1 | cut -d" " -f2,3)" 124 get_info "cpu model" cpuinfo
118 local machinfo="$(awk -F: '/^system type/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | cut -d" " -f2-)" 125 get_info "system type" machinfo
119 local machtype="" 126 cpuinfo="${cpuinfo%% FPU*}"
120 127
121 case "${machinfo}" in 128 case "${machinfo}" in
122 "SGI Indy")
123 machtype="SGI Indy" # Indy R4x00/R5000
124 ;;
125 "SGI Indigo2") 129 "SGI Indigo2")
126 case "${cpuinfo}" in 130 case "${cpuinfo}" in
127 R4*) 131 R4*)
128 machtype="SGI Indigo2" # I2 R4x00 132 machinfo="SGI Indigo2" # I2 R4x00
129 ;; 133 ;;
130 R8*) 134 R8*)
131 machtype="SGI Indigo2 Power" # I2 R8000 135 machinfo="SGI Indigo2 Power" # I2 R8000
132 ;; 136 ;;
133 R10*) 137 R10*)
134 machtype="SGI Indigo2 Impact" # I2 R10000 138 machinfo="SGI Indigo2 Impact" # I2 R10000
135 ;; 139 ;;
136 esac 140 esac
137 ;;
138 "SGI O2"|"SGI IP32")
139 machtype="SGI O2" # O2 R5K/RM5K2/RM7K/R10K/R12K
140 ;;
141 "SGI Octane"|"SGI IP30")
142 machtype="SGI Octane" # Octane R10K/R12K/R14K
143 ;;
144 "SGI Origin"|"SGI IP27")
145 machtype="SGI Origin" # Origin R10K/R12K
146 ;;
147 *)
148 machtype="Unknown SGI MIPS" # ???
149 ;; 141 ;;
150 esac 142 esac
151 143
152 PC="Detected an ${machtype} w/ ${numcpu} ${cpuinfo} ${bit}" 144 PC="Detected an ${machinfo} w/ ${numcpu} ${cpuinfo} CPU(s)"
153} 145}
154 146
155detect_x86_amd64() { 147detect_x86_amd64_ia64() {
156 local cpuinfo="$(awk -F: '/^model name/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 148 [ "$1" = "ia64" ] \
157 local mhz="$(awk -F: '/^cpu MHz/{printf " %dMHz",int($2)};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 149 && get_info "family" cpuinfo \
150 || get_info "model name" cpuinfo
151 get_info "cpu MHz" mhz
152 mhz="~${mhz%%.*}MHz"
158 153
159 PC="Detected ${numcpu} ${cpuinfo} ${mhz} ${bit}" 154 PC="Detected ${numcpu} ${cpuinfo} CPU(s) @ ${mhz} each"
160} 155}
161 156
162detect_alpha() { 157detect_alpha() {
163 local cpuinfo="$(awk -F: '/^platform string/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 158 get_info "platform string" machinfo
164 local numcpu="$(awk -F: '/^cpus detected/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 159 get_info "cpu" cpuinfo1
165 if [ "${numcpu}" -gt '1' ] 160 get_info "cpu model" cpuinfo2
166 then 161 get_info "cpus detected" numcpu
167 bit="CPUs" 162
168 else 163 PC="Detected ${numcpu} ${cpuinfo1} ${cpuinfo2} CPU(s) in a ${machinfo} system"
169 bit="CPU"
170 fi
171 PC="Detected ${numcpu} ${cpuinfo} ${bit}"
172} 164}
173 165
174detect_ppc() { 166detect_ppc() {
175 local cpuinfo="$(awk -F: '/^cpu/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 167 get_info "cpu" cpuinfo
176 local mhz="$(awk -F: '/^clock/{printf " %dMHz",int($2)};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 168 get_info "clock" mhz
177 local machinfo="$(awk -F: '/^detected as/{printf $2}' /proc/cpuinfo | cut -d'(' -f2 | cut -d')' -f1)" 169 get_info "detected as" machinfo
170 machinfo="${machinfo##*\(}"
171 machinfo="${machinfo%%\)*}"
172
178 local machtype="" 173 local machtype=""
179 # if [ -z "machinfo" ]
180 # then
181 # machinfo=$(awk -F: '/^machine/{printf $2}' /proc/cpuinfo)"
182 # fi
183 174
184 case "${machinfo}" in 175 case "${machinfo}" in
185 "PowerMac G4 AGP Graphics") 176 "PowerMac G4 AGP Graphics")
186 machtype="Apple PowerMac G4" 177 machtype="Apple PowerMac G4"
187 ;; 178 ;;
212 *) 203 *)
213 machtype="Unknown PPC System" 204 machtype="Unknown PPC System"
214 ;; 205 ;;
215 esac 206 esac
216 207
217 PC="Detected an ${machtype} w/ ${numcpu} ${cpuinfo} ${bit}" 208 PC="Detected a(n) ${machtype} w/ ${numcpu} ${cpuinfo} CPU(s)"
209}
210
211detect_sparc() {
212 get_info "cpu" cpuinfo
213 get_info "ncpus active" numcpu
214 get_info "ncpus probed" numprobed
215
216 PC="Detected ${numcpu} active ${cpuinfo} CPU(s) of ${numprobed} total"
218} 217}
219 218
220start() { 219start() {
221 echo "0" > /proc/sys/kernel/printk 220 echo "0" > /proc/sys/kernel/printk
222 get_config 221 get_config
223 if [ "${DETECT}" = "yes" ] 222 if [ "${DETECT}" = "yes" ]
224 then 223 then
225 ebegin "Hardware detection started" 224 ebegin "Hardware detection started"
226 local numcpu="$(awk -F: '/^processor/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | wc -l)" 225 local numcpu="$(grep -c '^processor[[:space:]]\+:' /proc/cpuinfo)"
227 local arch="$(uname -m)" 226 local arch="$(uname -m)"
228 local ismips="no" 227
229 if [ "${numcpu}" -gt '1' ]
230 then
231 bit="CPUs"
232 else
233 bit="CPU"
234 fi
235 case ${arch} in 228 case ${arch} in
236 mips|mips64) 229 mips*)
237 detect_mips 230 detect_mips
238 ismips="yes" 231 ACPI="no"
232 APM="no"
233 IDEDMA="no"
239 ;; 234 ;;
240 i?86|x86_64) 235 i?86|x86_64)
241 detect_x86_amd64 236 detect_x86_amd64_ia64
242 ;; 237 ;;
243 alpha) 238 alpha)
244 detect_alpha 239 detect_alpha
240 ACPI="no"
241 APM="no"
242 ;;
243 sparc*)
244 detect_sparc
245 ACPI="no"
246 APM="no"
245 ;; 247 ;;
246 powerpc*) 248 powerpc*)
247 detect_ppc 249 detect_ppc
250 ACPI="no"
251 APM="no"
252 ;;
253 ia64)
254 detect_x86_amd64_ia64 "ia64"
255 APM="no"
248 ;; 256 ;;
249 *) 257 *)
250 PC="$(awk -F: '/^processor/{printf "Processor"$2" is"};/^model name/{printf $2};/^vendor_id/{printf vendor};/^cpu MHz/{printf " %dMHz",int($2)};/^cache size/{printf ","$2" Cache"};/^$/{print ""}' /proc/cpuinfo 2>/dev/null)" 258 PC=
251 ;; 259 ;;
252 esac 260 esac
253 einfo "${PC}" 261 [ -n "${PC}" ] && einfo "${PC}"
254 [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null 262 [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null
255 eend 263 eend
256 else 264 else
257 ewarn "Hardware detection disabled via cmdline ..." 265 ewarn "Hardware detection disabled via cmdline ..."
258 fi 266 fi
261 then 269 then
262 modprobe apm power_off=1 >/dev/null 2>&1 && \ 270 modprobe apm power_off=1 >/dev/null 2>&1 && \
263 einfo "APM BIOS found, power management functions enabled ..." 271 einfo "APM BIOS found, power management functions enabled ..."
264 [ -x /etc/init.d/apmd ] && start_service apmd 272 [ -x /etc/init.d/apmd ] && start_service apmd
265 else 273 else
266 [ "${ismips}" = "no" ] && ewarn "Not Loading APM Bios support ..." 274 einfo "Not Loading APM Bios support ..."
267 fi 275 fi
268 276
269 if [ "${ACPI}" = "yes" ] 277 if [ "${ACPI}" = "yes" ]
270 then 278 then
271 modprobe processor >/dev/null 2>&1 && \ 279 modprobe processor >/dev/null 2>&1 && \
276 modprobe battery >/dev/null 2>&1 284 modprobe battery >/dev/null 2>&1
277 modprobe ac >/dev/null 2>&1 285 modprobe ac >/dev/null 2>&1
278 [ -x /etc/init.d/acpid ] && start_service acpid 286 [ -x /etc/init.d/acpid ] && start_service acpid
279 eend 287 eend
280 else 288 else
281 [ "${ismips}" = "no" ] && ewarn "Not Loading ACPI support ..." 289 einfo "Not Loading ACPI support ..."
282 fi 290 fi
283 291
284 if [ "${IDEDMA}" = "yes" ] 292 if [ "${IDEDMA}" = "yes" ]
285 then 293 then
286 if [ "${ismips}" = "no" ]; then
287 [ -x /etc/init.d/hdparm ] && start_service hdparm 294 [ -x /etc/init.d/hdparm ] && start_service hdparm
288 fi
289 fi 295 fi
290 296
291 if [ "${PCMCIA}" = "yes" ] 297 if [ "${PCMCIA}" = "yes" ]
292 then 298 then
293 einfo "PCMCIA enabled via cmdline ..." 299 einfo "PCMCIA enabled via cmdline ..."
302 /etc/conf.d/net 308 /etc/conf.d/net
303 ewarn "Skipping DHCP broadcast detection as requested on boot commandline ..." 309 ewarn "Skipping DHCP broadcast detection as requested on boot commandline ..."
304 fi 310 fi
305 311
306 # Read in what hwsetup has found 312 # Read in what hwsetup has found
307 [ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix
308 [ -f /etc/sysconfig/gentoo ] && . /etc/sysconfig/gentoo 313 [ -f /etc/sysconfig/gentoo ] && . /etc/sysconfig/gentoo
309 314
310 # Mouse 315 # Mouse
311 if [ -n "${MOUSE_DEVICE}" ] 316 if [ -n "${MOUSE_DEVICE}" ]
312 then 317 then
410 ewarn "Skipping ALSA detection as requested on command line ..." 415 ewarn "Skipping ALSA detection as requested on command line ..."
411 fi 416 fi
412 417
413 if [ "${X11}" = "yes" ] 418 if [ "${X11}" = "yes" ]
414 then 419 then
415 [ -x /etc/init.d/x-setup ] && start_service x-setup 420 if [ -x /etc/init.d/x-setup ]
421 then
422 start_service x-setup
423 elif [ -x /etc/init.d/mkxf86config ]
424 then
425 start_service mkxf86config
426 fi
416 else 427 else
417 touch /etc/init.d/.noxdm 428 touch /etc/init.d/.noxdm
418 fi 429 fi
419 430
420 [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}" 431 [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}"

Legend:
Removed from v.107  
changed lines
  Added in v.109

  ViewVC Help
Powered by ViewVC 1.1.20