/[livecd-tools]/trunk/autoconfig
Gentoo

Diff of /trunk/autoconfig

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

Revision 78 Revision 91
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.43 2005/10/12 17:15:27 wolf31o2 Exp $ 4# $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.53 2006/01/21 22:44:13 wolf31o2 Exp $
5 5
6DHCP="yes" 6DHCP="yes"
7DETECT="yes" 7DETECT="yes"
8GPM="yes" 8GPM="yes"
9PCMCIA="no" 9PCMCIA="no"
95 svcs="${svcs} $(check_svc ${ALSA} alsasound)" 95 svcs="${svcs} $(check_svc ${ALSA} alsasound)"
96 96
97 echo ${svcs} 97 echo ${svcs}
98} 98}
99 99
100# Only used on SGI CDs, this determines:
101# A) CPU Type
102# B) System
103detect_mips() {
104 local cpuinfo="$(awk -F: '/^cpu model/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1 | cut -d" " -f2,3)"
105 local machinfo="$(awk -F: '/^system type/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | cut -d" " -f2-)"
106 local machtype=""
107
108 case "${machinfo}" in
109 "SGI Indy")
110 machtype="SGI Indy" # Indy R4x00/R5000
111 ;;
112 "SGI Indigo2")
113 case "${cpuinfo}" in
114 R4*)
115 machtype="SGI Indigo2" # I2 R4x00
116 ;;
117 R8*)
118 machtype="SGI Indigo2 Power" # I2 R8000
119 ;;
120 R10*)
121 machtype="SGI Indigo2 Impact" # I2 R10000
122 ;;
123 esac
124 ;;
125 "SGI O2"|"SGI IP32")
126 machtype="SGI O2" # O2 R5K/RM5K2/RM7K/R10K/R12K
127 ;;
128 "SGI Octane"|"SGI IP30")
129 machtype="SGI Octane" # Octane R10K/R12K/R14K
130 ;;
131 "SGI Origin"|"SGI IP27")
132 machtype="SGI Origin" # Origin R10K/R12K
133 ;;
134 *)
135 machtype="Unknown SGI MIPS" # ???
136 ;;
137 esac
138
139 PC="Detected an ${machtype} w/ ${numcpu} ${cpuinfo} ${bit}"
140}
141
142detect_x86_amd64() {
143 local cpuinfo="$(awk -F: '/^model name/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)"
144 local mhz="$(awk -F: '/^cpu MHz/{printf " %dMHz",int($2)};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)"
145
146 PC="Detected ${numcpu} ${cpuinfo} ${mhz} ${bit}"
147}
148
149detect_ppc() {
150 local cpuinfo="$(awk -F: '/^cpu/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)"
151 local mhz="$(awk -F: '/^clock/{printf " %dMHz",int($2)};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)"
152 local machinfo="$(awk -F: '/^detected as/{printf $2}' /proc/cpuinfo | cut -d'(' -f2 | cut -d')' -f1)"
153 local machtype=""
154 # if [ -z "machinfo" ]
155 # then
156 # machinfo=$(awk -F: '/^machine/{printf $2}' /proc/cpuinfo)"
157 # fi
158
159 case "${machinfo}" in
160 "PowerMac G4 AGP Graphics")
161 machtype="Apple PowerMac G4"
162 ;;
163 "PowerBook Titanium")
164 machtype="Apple Powerbook G4"
165 ;;
166 "iBook 2 rev. 2")
167 machtype="Apple iBook G3"
168 ;;
169 "PowerMac G5 Dual Core")
170 machtype="Apple PowerMac G5 Dual Core"
171 ;;
172 "Unknown Intrepid-based")
173 machtype="Apple Mac-Mini"
174 ;;
175 "MPC8241")
176 machtype="Kurobox"
177 ;;
178 "CHRP Pegasos2")
179 machtype="Pegasos 2"
180 ;;
181 *)
182 machtype="Unknown PPC System"
183 ;;
184 esac
185
186 PC="Detected an ${machtype} w/ ${numcpu} ${cpuinfo} ${bit}"
187}
188
100start() { 189start() {
101 echo "0" > /proc/sys/kernel/printk 190 echo "0" > /proc/sys/kernel/printk
102 get_config 191 get_config
103 if [ "${DETECT}" = "yes" ] 192 if [ "${DETECT}" = "yes" ]
104 then 193 then
105 ebegin "Hardware detection started" 194 ebegin "Hardware detection started"
195 local numcpu="$(awk -F: '/^processor/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | wc -l)"
196 local arch="$(uname -m)"
197 local ismips="no"
198 [ "${numcpu}" -gt '1' ] && bit="CPUs" || bit="CPU"
199 case ${arch} in
200 mips|mips64)
201 detect_mips
202 ismips="yes"
203 ;;
204 i?86|x86_64)
205 detect_x86_amd64
206 ;;
207 *)
106 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)" 208 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)"
209 ;;
210 esac
107 einfo "${PC}" 211 einfo "${PC}"
108 [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null 212 [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null
109 eend 213 eend
110 else 214 else
111 ewarn "Hardware detection disabled via cmdline ..." 215 ewarn "Hardware detection disabled via cmdline ..."
115 then 219 then
116 modprobe apm power_off=1 >/dev/null 2>&1 && \ 220 modprobe apm power_off=1 >/dev/null 2>&1 && \
117 einfo "APM BIOS found, power management functions enabled ..." 221 einfo "APM BIOS found, power management functions enabled ..."
118 [ -x /etc/init.d/apmd ] && start_service apmd 222 [ -x /etc/init.d/apmd ] && start_service apmd
119 else 223 else
120 ewarn "Not Loading APM Bios support ..." 224 [ "${ismips}" = "no" ] && ewarn "Not Loading APM Bios support ..."
121 fi 225 fi
122 226
123 if [ "${ACPI}" = "yes" ] 227 if [ "${ACPI}" = "yes" ]
124 then 228 then
125 modprobe processor >/dev/null 2>&1 && \ 229 modprobe processor >/dev/null 2>&1 && \
130 modprobe battery >/dev/null 2>&1 234 modprobe battery >/dev/null 2>&1
131 modprobe ac >/dev/null 2>&1 235 modprobe ac >/dev/null 2>&1
132 [ -x /etc/init.d/acpid ] && start_service acpid 236 [ -x /etc/init.d/acpid ] && start_service acpid
133 eend 237 eend
134 else 238 else
135 ewarn "Not Loading ACPI support ..." 239 [ "${ismips}" = "no" ] && ewarn "Not Loading ACPI support ..."
136 fi 240 fi
137 241
138 if [ "${IDEDMA}" = "yes" ] 242 if [ "${IDEDMA}" = "yes" ]
139 then 243 then
244 if [ "${ismips}" = "no" ]; then
140 [ -x /etc/init.d/hdparm ] && start_service hdparm 245 [ -x /etc/init.d/hdparm ] && start_service hdparm
246 fi
141 fi 247 fi
142 248
143 if [ "${PCMCIA}" = "yes" ] 249 if [ "${PCMCIA}" = "yes" ]
144 then 250 then
145 einfo "PCMCIA enabled via cmdline ..." 251 einfo "PCMCIA enabled via cmdline ..."
226 332
227 333
228 if [ -x /etc/init.d/alsasound ] 334 if [ -x /etc/init.d/alsasound ]
229 then 335 then
230 start_service alsasound 336 start_service alsasound
231 else
232 ewarn "/etc/init.d/alsasound not found, skipping ..."
233 ewarn "You will need to set volume controls manually ..."
234 fi 337 fi
235 338
339 if [ -e /proc/asound/cards ]
340 then
236 for i in $(cat /proc/asound/cards | cut -d" " -f1) 341 for i in $(cat /proc/asound/cards | cut -d" " -f1)
237 do 342 do
238 if [ -d /proc/asound/card$i ] && [ -x /usr/bin/amixer ] 343 if [ -d /proc/asound/card$i ] && [ -x /usr/bin/amixer ]
239 then 344 then
240 amixer -c $i scontrols > /etc/amixer 345 amixer -c $i scontrols > /etc/amixer
241 [ -n "$(grep Master /etc/amixer)" ] \ 346 [ -n "$(grep Master /etc/amixer)" ] \
242 && amixer -c $i -q set Master 95% unmute \ 347 && amixer -c $i -q set Master 95% unmute \
243 >/dev/null 2>&1 348 >/dev/null 2>&1
244 [ -n "$(grep PCM /etc/amixer)" ] \ 349 [ -n "$(grep PCM /etc/amixer)" ] \
245 && amixer -c $i -q set PCM 95% unmute \ 350 && amixer -c $i -q set PCM 95% unmute \
246 >/dev/null 2>&1 351 >/dev/null 2>&1
247 [ -n "$(grep Mic /etc/amixer)" ] \ 352 [ -n "$(grep Mic /etc/amixer)" ] \
248 && amixer -c $i -q set Mic 95% mute cap \ 353 && amixer -c $i -q set Mic 95% mute cap \
249 >/dev/null 2>&1 354 >/dev/null 2>&1
250 [ -n "$(grep Wave /etc/amixer)" ] \ 355 [ -n "$(grep Wave /etc/amixer)" ] \
251 && amixer -c $i -q set Wave 95% unmute \ 356 && amixer -c $i -q set Wave 95% unmute \
252 >/dev/null 2>&1 357 >/dev/null 2>&1
253 [ -n "$(grep Capture /etc/amixer)" ] \ 358 [ -n "$(grep Capture /etc/amixer)" ] \
254 && amixer -c $i -q set Capture 95% unmute cap \ 359 && amixer -c $i -q set Capture 95% unmute cap \
255 >/dev/null 2>&1 360 >/dev/null 2>&1
256 fi 361 fi
257 done 362 done
363 fi
258 fi 364 fi
259 else 365 else
260 ewarn "Skipping ALSA detection as requested on boot commandline ..." 366 ewarn "Skipping ALSA detection as requested on command line ..."
261 fi 367 fi
262 368
263 if [ "${DETECT}" = "yes" ] 369 if [ "${DETECT}" = "yes" ]
264 then 370 then
265 [ -x /etc/init.d/x-setup ] && schedule_service_startup x-setup 371 [ -x /etc/init.d/x-setup ] && start_service x-setup
266 fi 372 fi
267 373
268 [ "${X11}" = "no" ] && touch /etc/init.d/.noxdm 374 [ "${X11}" = "no" ] && touch /etc/init.d/.noxdm
269 [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}" 375 [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}"
270 376

Legend:
Removed from v.78  
changed lines
  Added in v.91

  ViewVC Help
Powered by ViewVC 1.1.13