| 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.46 2005/10/17 15:08:59 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 | |
| 100 | start() { |
149 | start() { |
| 101 | echo "0" > /proc/sys/kernel/printk |
150 | echo "0" > /proc/sys/kernel/printk |
| 102 | get_config |
151 | get_config |
| 103 | if [ "${DETECT}" = "yes" ] |
152 | if [ "${DETECT}" = "yes" ] |
| 104 | then |
153 | then |
| 105 | ebegin "Hardware detection started" |
154 | ebegin "Hardware detection started" |
|
|
155 | local numcpu="$(awk -F: '/^processor/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | wc -l)" |
|
|
156 | local arch="$(uname -m)" |
|
|
157 | local ismips="no" |
|
|
158 | [ "${numcpu}" -gt '1' ] && bit="CPUs" || bit="CPU" |
|
|
159 | case ${arch} in |
|
|
160 | mips|mips64) |
|
|
161 | detect_mips |
|
|
162 | ismips="yes" |
|
|
163 | ;; |
|
|
164 | i386|i486|i586|i686|x86_64) |
|
|
165 | detect_x86_amd64 |
|
|
166 | ;; |
|
|
167 | *) |
| 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)" |
168 | 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)" |
|
|
169 | ;; |
|
|
170 | esac |
| 107 | einfo "${PC}" |
171 | einfo "${PC}" |
| 108 | [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null |
172 | [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null |
| 109 | eend |
173 | eend |
| 110 | else |
174 | else |
| 111 | ewarn "Hardware detection disabled via cmdline ..." |
175 | ewarn "Hardware detection disabled via cmdline ..." |
| … | |
… | |
| 115 | then |
179 | then |
| 116 | modprobe apm power_off=1 >/dev/null 2>&1 && \ |
180 | modprobe apm power_off=1 >/dev/null 2>&1 && \ |
| 117 | einfo "APM BIOS found, power management functions enabled ..." |
181 | einfo "APM BIOS found, power management functions enabled ..." |
| 118 | [ -x /etc/init.d/apmd ] && start_service apmd |
182 | [ -x /etc/init.d/apmd ] && start_service apmd |
| 119 | else |
183 | else |
| 120 | ewarn "Not Loading APM Bios support ..." |
184 | [ "${ismips}" = "no" ] && ewarn "Not Loading APM Bios support ..." |
| 121 | fi |
185 | fi |
| 122 | |
186 | |
| 123 | if [ "${ACPI}" = "yes" ] |
187 | if [ "${ACPI}" = "yes" ] |
| 124 | then |
188 | then |
| 125 | modprobe processor >/dev/null 2>&1 && \ |
189 | modprobe processor >/dev/null 2>&1 && \ |
| … | |
… | |
| 130 | modprobe battery >/dev/null 2>&1 |
194 | modprobe battery >/dev/null 2>&1 |
| 131 | modprobe ac >/dev/null 2>&1 |
195 | modprobe ac >/dev/null 2>&1 |
| 132 | [ -x /etc/init.d/acpid ] && start_service acpid |
196 | [ -x /etc/init.d/acpid ] && start_service acpid |
| 133 | eend |
197 | eend |
| 134 | else |
198 | else |
| 135 | ewarn "Not Loading ACPI support ..." |
199 | [ "${ismips}" = "no" ] && ewarn "Not Loading ACPI support ..." |
| 136 | fi |
200 | fi |
| 137 | |
201 | |
| 138 | if [ "${IDEDMA}" = "yes" ] |
202 | if [ "${IDEDMA}" = "yes" ] |
| 139 | then |
203 | then |
|
|
204 | if [ "${ismips}" = "no" ]; then |
| 140 | [ -x /etc/init.d/hdparm ] && start_service hdparm |
205 | [ -x /etc/init.d/hdparm ] && start_service hdparm |
|
|
206 | fi |
| 141 | fi |
207 | fi |
| 142 | |
208 | |
| 143 | if [ "${PCMCIA}" = "yes" ] |
209 | if [ "${PCMCIA}" = "yes" ] |
| 144 | then |
210 | then |
| 145 | einfo "PCMCIA enabled via cmdline ..." |
211 | einfo "PCMCIA enabled via cmdline ..." |