| 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.57 2006/04/23 17:06:38 wolf31o2 Exp $ |
| 5 | |
5 | |
| 6 | DHCP="yes" |
6 | DHCP="yes" |
| 7 | DETECT="yes" |
7 | DETECT="yes" |
| 8 | GPM="yes" |
8 | GPM="yes" |
| 9 | PCMCIA="no" |
9 | PCMCIA="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 |
|
|
103 | detect_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 | |
|
|
142 | detect_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 | |
|
|
149 | detect_alpha() { |
|
|
150 | local cpuinfo="$(awk -F: '/^platform string/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" |
|
|
151 | local numcpu="$(awk -F: '/^cpus active/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" |
|
|
152 | if [ "${numcpu}" -gt '1' ] |
|
|
153 | then |
|
|
154 | bit="CPUs" |
|
|
155 | else |
|
|
156 | bit="CPU" |
|
|
157 | fi |
|
|
158 | PC="Detected ${numcpu} ${cpuinfo} ${bit}" |
|
|
159 | } |
|
|
160 | |
|
|
161 | detect_ppc() { |
|
|
162 | local cpuinfo="$(awk -F: '/^cpu/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" |
|
|
163 | local mhz="$(awk -F: '/^clock/{printf " %dMHz",int($2)};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" |
|
|
164 | local machinfo="$(awk -F: '/^detected as/{printf $2}' /proc/cpuinfo | cut -d'(' -f2 | cut -d')' -f1)" |
|
|
165 | local machtype="" |
|
|
166 | # if [ -z "machinfo" ] |
|
|
167 | # then |
|
|
168 | # machinfo=$(awk -F: '/^machine/{printf $2}' /proc/cpuinfo)" |
|
|
169 | # fi |
|
|
170 | |
|
|
171 | case "${machinfo}" in |
|
|
172 | "PowerMac G4 AGP Graphics") |
|
|
173 | machtype="Apple PowerMac G4" |
|
|
174 | ;; |
|
|
175 | "PowerBook Titanium"|'PowerBook G4 15"') |
|
|
176 | machtype="Apple Powerbook G4" |
|
|
177 | ;; |
|
|
178 | "iBook 2 rev. 2") |
|
|
179 | machtype="Apple iBook G3" |
|
|
180 | ;; |
|
|
181 | "PowerMac G5") |
|
|
182 | machtype="Apple PowerMac G5" |
|
|
183 | ;; |
|
|
184 | "PowerMac G5 Dual Core") |
|
|
185 | machtype="Apple PowerMac G5 Dual Core" |
|
|
186 | ;; |
|
|
187 | "Unknown Intrepid-based") |
|
|
188 | machtype="Apple Mac-Mini" |
|
|
189 | ;; |
|
|
190 | "MPC8241") |
|
|
191 | machtype="Kurobox" |
|
|
192 | ;; |
|
|
193 | "CHRP Pegasos2") |
|
|
194 | machtype="Pegasos 2" |
|
|
195 | ;; |
|
|
196 | "CHRP IBM,9124-720") |
|
|
197 | machtype="IBM OP720" |
|
|
198 | ;; |
|
|
199 | *) |
|
|
200 | machtype="Unknown PPC System" |
|
|
201 | ;; |
|
|
202 | esac |
|
|
203 | |
|
|
204 | PC="Detected an ${machtype} w/ ${numcpu} ${cpuinfo} ${bit}" |
|
|
205 | } |
|
|
206 | |
| 100 | start() { |
207 | start() { |
| 101 | echo "0" > /proc/sys/kernel/printk |
208 | echo "0" > /proc/sys/kernel/printk |
| 102 | get_config |
209 | get_config |
| 103 | if [ "${DETECT}" = "yes" ] |
210 | if [ "${DETECT}" = "yes" ] |
| 104 | then |
211 | then |
| 105 | ebegin "Hardware detection started" |
212 | ebegin "Hardware detection started" |
|
|
213 | local numcpu="$(awk -F: '/^processor/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | wc -l)" |
|
|
214 | local arch="$(uname -m)" |
|
|
215 | local ismips="no" |
|
|
216 | if [ "${numcpu}" -gt '1' ] |
|
|
217 | then |
|
|
218 | bit="CPUs" |
|
|
219 | else |
|
|
220 | bit="CPU" |
|
|
221 | fi |
|
|
222 | case ${arch} in |
|
|
223 | mips|mips64) |
|
|
224 | detect_mips |
|
|
225 | ismips="yes" |
|
|
226 | ;; |
|
|
227 | i?86|x86_64) |
|
|
228 | detect_x86_amd64 |
|
|
229 | ;; |
|
|
230 | alpha) |
|
|
231 | detect_alpha |
|
|
232 | ;; |
|
|
233 | powerpc*) |
|
|
234 | detect_ppc |
|
|
235 | ;; |
|
|
236 | *) |
| 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)" |
237 | 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)" |
|
|
238 | ;; |
|
|
239 | esac |
| 107 | einfo "${PC}" |
240 | einfo "${PC}" |
| 108 | [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null |
241 | [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null |
| 109 | eend |
242 | eend |
| 110 | else |
243 | else |
| 111 | ewarn "Hardware detection disabled via cmdline ..." |
244 | ewarn "Hardware detection disabled via cmdline ..." |
| … | |
… | |
| 115 | then |
248 | then |
| 116 | modprobe apm power_off=1 >/dev/null 2>&1 && \ |
249 | modprobe apm power_off=1 >/dev/null 2>&1 && \ |
| 117 | einfo "APM BIOS found, power management functions enabled ..." |
250 | einfo "APM BIOS found, power management functions enabled ..." |
| 118 | [ -x /etc/init.d/apmd ] && start_service apmd |
251 | [ -x /etc/init.d/apmd ] && start_service apmd |
| 119 | else |
252 | else |
| 120 | ewarn "Not Loading APM Bios support ..." |
253 | [ "${ismips}" = "no" ] && ewarn "Not Loading APM Bios support ..." |
| 121 | fi |
254 | fi |
| 122 | |
255 | |
| 123 | if [ "${ACPI}" = "yes" ] |
256 | if [ "${ACPI}" = "yes" ] |
| 124 | then |
257 | then |
| 125 | modprobe processor >/dev/null 2>&1 && \ |
258 | modprobe processor >/dev/null 2>&1 && \ |
| … | |
… | |
| 130 | modprobe battery >/dev/null 2>&1 |
263 | modprobe battery >/dev/null 2>&1 |
| 131 | modprobe ac >/dev/null 2>&1 |
264 | modprobe ac >/dev/null 2>&1 |
| 132 | [ -x /etc/init.d/acpid ] && start_service acpid |
265 | [ -x /etc/init.d/acpid ] && start_service acpid |
| 133 | eend |
266 | eend |
| 134 | else |
267 | else |
| 135 | ewarn "Not Loading ACPI support ..." |
268 | [ "${ismips}" = "no" ] && ewarn "Not Loading ACPI support ..." |
| 136 | fi |
269 | fi |
| 137 | |
270 | |
| 138 | if [ "${IDEDMA}" = "yes" ] |
271 | if [ "${IDEDMA}" = "yes" ] |
| 139 | then |
272 | then |
|
|
273 | if [ "${ismips}" = "no" ]; then |
| 140 | [ -x /etc/init.d/hdparm ] && start_service hdparm |
274 | [ -x /etc/init.d/hdparm ] && start_service hdparm |
|
|
275 | fi |
| 141 | fi |
276 | fi |
| 142 | |
277 | |
| 143 | if [ "${PCMCIA}" = "yes" ] |
278 | if [ "${PCMCIA}" = "yes" ] |
| 144 | then |
279 | then |
| 145 | einfo "PCMCIA enabled via cmdline ..." |
280 | einfo "PCMCIA enabled via cmdline ..." |
| … | |
… | |
| 226 | |
361 | |
| 227 | |
362 | |
| 228 | if [ -x /etc/init.d/alsasound ] |
363 | if [ -x /etc/init.d/alsasound ] |
| 229 | then |
364 | then |
| 230 | start_service alsasound |
365 | 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 |
366 | fi |
| 235 | |
367 | |
|
|
368 | if [ -e /proc/asound/cards ] |
|
|
369 | then |
| 236 | for i in $(cat /proc/asound/cards | cut -d" " -f1) |
370 | for i in $(cat /proc/asound/cards | cut -d" " -f1) |
| 237 | do |
371 | do |
| 238 | if [ -d /proc/asound/card$i ] && [ -x /usr/bin/amixer ] |
372 | if [ -d /proc/asound/card$i ] && [ -x /usr/bin/amixer ] |
| 239 | then |
373 | then |
| 240 | amixer -c $i scontrols > /etc/amixer |
374 | amixer -c $i scontrols > /etc/amixer |
| 241 | [ -n "$(grep Master /etc/amixer)" ] \ |
375 | [ -n "$(grep Master /etc/amixer)" ] \ |
| 242 | && amixer -c $i -q set Master 95% unmute \ |
376 | && amixer -c $i -q set Master 95% unmute \ |
| 243 | >/dev/null 2>&1 |
377 | >/dev/null 2>&1 |
| 244 | [ -n "$(grep PCM /etc/amixer)" ] \ |
378 | [ -n "$(grep PCM /etc/amixer)" ] \ |
| 245 | && amixer -c $i -q set PCM 95% unmute \ |
379 | && amixer -c $i -q set PCM 95% unmute \ |
| 246 | >/dev/null 2>&1 |
380 | >/dev/null 2>&1 |
| 247 | [ -n "$(grep Mic /etc/amixer)" ] \ |
381 | [ -n "$(grep Mic /etc/amixer)" ] \ |
| 248 | && amixer -c $i -q set Mic 95% mute cap \ |
382 | && amixer -c $i -q set Mic 95% mute cap \ |
| 249 | >/dev/null 2>&1 |
383 | >/dev/null 2>&1 |
| 250 | [ -n "$(grep Wave /etc/amixer)" ] \ |
384 | [ -n "$(grep Wave /etc/amixer)" ] \ |
| 251 | && amixer -c $i -q set Wave 95% unmute \ |
385 | && amixer -c $i -q set Wave 95% unmute \ |
| 252 | >/dev/null 2>&1 |
386 | >/dev/null 2>&1 |
| 253 | [ -n "$(grep Capture /etc/amixer)" ] \ |
387 | [ -n "$(grep Capture /etc/amixer)" ] \ |
| 254 | && amixer -c $i -q set Capture 95% unmute cap \ |
388 | && amixer -c $i -q set Capture 95% unmute cap \ |
| 255 | >/dev/null 2>&1 |
389 | >/dev/null 2>&1 |
| 256 | fi |
390 | fi |
| 257 | done |
391 | done |
|
|
392 | fi |
| 258 | fi |
393 | fi |
| 259 | else |
394 | else |
| 260 | ewarn "Skipping ALSA detection as requested on boot commandline ..." |
395 | ewarn "Skipping ALSA detection as requested on command line ..." |
| 261 | fi |
396 | fi |
| 262 | |
397 | |
| 263 | if [ "${DETECT}" = "yes" ] |
398 | if [ "${DETECT}" = "yes" ] |
| 264 | then |
399 | then |
| 265 | [ -x /etc/init.d/x-setup ] && schedule_service_startup x-setup |
400 | [ -x /etc/init.d/x-setup ] && start_service x-setup |
| 266 | fi |
401 | fi |
| 267 | |
402 | |
| 268 | [ "${X11}" = "no" ] && touch /etc/init.d/.noxdm |
403 | [ "${X11}" = "no" ] && touch /etc/init.d/.noxdm |
| 269 | [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}" |
404 | [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}" |
| 270 | |
405 | |