| 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.44 2005/10/12 17:42:25 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) Number of CPUs |
|
|
102 | # B) CPU Type |
|
|
103 | # C) System |
|
|
104 | DetectMips() { |
|
|
105 | local numcpu="$(awk -F: '/^processor/{printf $2"\n"};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | wc -l)" |
|
|
106 | local cpuinfo="$(awk -F: '/^cpu model/{printf $2"\n"};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1 | cut -d" " -f2,3)" |
|
|
107 | local machinfo="$(awk -F: '/^system type/{printf $2"\n"};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | cut -d" " -f2-)" |
|
|
108 | local machtype="" |
|
|
109 | local bit="" |
|
|
110 | |
|
|
111 | case "${machinfo}" in |
|
|
112 | "SGI Indy") |
|
|
113 | machtype="SGI Indy" # Indy R4x00/R5000 |
|
|
114 | ;; |
|
|
115 | "SGI Indigo2") |
|
|
116 | case "${cpuinfo}" in |
|
|
117 | R4*) |
|
|
118 | machtype="SGI Indigo2" # I2 R4x00 |
|
|
119 | ;; |
|
|
120 | R8*) |
|
|
121 | machtype="SGI Indigo2 Power" # I2 R8000 |
|
|
122 | ;; |
|
|
123 | R10*) |
|
|
124 | machtype="SGI Indigo2 Impact" # I2 R10000 |
|
|
125 | ;; |
|
|
126 | esac |
|
|
127 | ;; |
|
|
128 | "SGI O2"|"SGI IP32") |
|
|
129 | machtype="SGI O2" # O2 R5K/RM5K2/RM7K/R10K/R12K |
|
|
130 | ;; |
|
|
131 | "SGI Octane"|"SGI IP30") |
|
|
132 | machtype="SGI Octane" # Octane R10K/R12K/R14K |
|
|
133 | ;; |
|
|
134 | "SGI Origin"|"SGI IP27") |
|
|
135 | machtype="SGI Origin" # Origin R10K/R12K |
|
|
136 | ;; |
|
|
137 | *) |
|
|
138 | machtype="Unknown SGI MIPS" # ??? |
|
|
139 | ;; |
|
|
140 | esac |
|
|
141 | |
|
|
142 | [ "${numcpu}" -gt '1' ] && bit="CPUs" || bit="CPU" |
|
|
143 | |
|
|
144 | PC="Detected an ${machtype} w/ ${numcpu} ${cpuinfo} ${bit}" |
|
|
145 | } |
|
|
146 | |
|
|
147 | |
| 100 | start() { |
148 | start() { |
| 101 | echo "0" > /proc/sys/kernel/printk |
149 | echo "0" > /proc/sys/kernel/printk |
| 102 | get_config |
150 | get_config |
| 103 | if [ "${DETECT}" = "yes" ] |
151 | if [ "${DETECT}" = "yes" ] |
| 104 | then |
152 | then |
| 105 | ebegin "Hardware detection started" |
153 | ebegin "Hardware detection started" |
|
|
154 | local mach="$(uname -m)" |
|
|
155 | local ismips="no" |
|
|
156 | if [ "${mach}" = "mips" -o "${mach}" = "mips64" ] |
|
|
157 | then |
|
|
158 | DetectMips |
|
|
159 | ismips="yes" |
|
|
160 | else |
| 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)" |
161 | 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)" |
|
|
162 | fi |
| 107 | einfo "${PC}" |
163 | einfo "${PC}" |
| 108 | [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null |
164 | [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null |
| 109 | eend |
165 | eend |
| 110 | else |
166 | else |
| 111 | ewarn "Hardware detection disabled via cmdline ..." |
167 | ewarn "Hardware detection disabled via cmdline ..." |
| … | |
… | |
| 115 | then |
171 | then |
| 116 | modprobe apm power_off=1 >/dev/null 2>&1 && \ |
172 | modprobe apm power_off=1 >/dev/null 2>&1 && \ |
| 117 | einfo "APM BIOS found, power management functions enabled ..." |
173 | einfo "APM BIOS found, power management functions enabled ..." |
| 118 | [ -x /etc/init.d/apmd ] && start_service apmd |
174 | [ -x /etc/init.d/apmd ] && start_service apmd |
| 119 | else |
175 | else |
| 120 | ewarn "Not Loading APM Bios support ..." |
176 | [ "${ismips}" = "no" ] && ewarn "Not Loading APM Bios support ..." |
| 121 | fi |
177 | fi |
| 122 | |
178 | |
| 123 | if [ "${ACPI}" = "yes" ] |
179 | if [ "${ACPI}" = "yes" ] |
| 124 | then |
180 | then |
| 125 | modprobe processor >/dev/null 2>&1 && \ |
181 | modprobe processor >/dev/null 2>&1 && \ |
| … | |
… | |
| 130 | modprobe battery >/dev/null 2>&1 |
186 | modprobe battery >/dev/null 2>&1 |
| 131 | modprobe ac >/dev/null 2>&1 |
187 | modprobe ac >/dev/null 2>&1 |
| 132 | [ -x /etc/init.d/acpid ] && start_service acpid |
188 | [ -x /etc/init.d/acpid ] && start_service acpid |
| 133 | eend |
189 | eend |
| 134 | else |
190 | else |
| 135 | ewarn "Not Loading ACPI support ..." |
191 | [ "${ismips}" = "no" ] && ewarn "Not Loading ACPI support ..." |
| 136 | fi |
192 | fi |
| 137 | |
193 | |
| 138 | if [ "${IDEDMA}" = "yes" ] |
194 | if [ "${IDEDMA}" = "yes" ] |
| 139 | then |
195 | then |
|
|
196 | if [ "${ismips}" = "no" ]; then |
| 140 | [ -x /etc/init.d/hdparm ] && start_service hdparm |
197 | [ -x /etc/init.d/hdparm ] && start_service hdparm |
|
|
198 | fi |
| 141 | fi |
199 | fi |
| 142 | |
200 | |
| 143 | if [ "${PCMCIA}" = "yes" ] |
201 | if [ "${PCMCIA}" = "yes" ] |
| 144 | then |
202 | then |
| 145 | einfo "PCMCIA enabled via cmdline ..." |
203 | einfo "PCMCIA enabled via cmdline ..." |