/[livecd-tools]/trunk/autoconfig
Gentoo

Diff of /trunk/autoconfig

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

Revision 98 Revision 141
1#!/sbin/runscript 1#!/sbin/runscript
2# Copyright 1999-2005 Gentoo Foundation
3# Distributed under the terms of the GNU General Public License v2
4# $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.57 2006/04/23 17:06:38 wolf31o2 Exp $
5 2
3# This script is used by Gentoo release media to start certain services and to
4# ensure a sane setup for a CD-based boot.
5
6ACPI="yes"
7ALSA="yes"
8APM="no"
9DETECT="yes"
6DHCP="yes" 10DHCP="yes"
7DETECT="yes" 11DMRAID="yes"
12EVMS="no"
13FIREWIRE="yes"
8GPM="yes" 14GPM="yes"
9PCMCIA="no" 15HALD="yes"
10HOTPLUG="yes" 16HOTPLUG="yes"
11APM="no"
12ACPI="no"
13IDEDMA="yes" 17IDEDMA="yes"
18LVM="no"
19MDADM="yes"
20NET="yes"
21NFS="yes"
22PASSWD="yes"
14ALSA="yes" 23PATA="yes"
24PCMCIA="yes"
25SATA="yes"
26SCSI="no"
27SSHD="no"
28USB="yes"
15X11="yes" 29X11="yes"
16 30
17get_config() { 31get_config() {
18 CMDLINE="$(cat /proc/cmdline)" 32 CMDLINE="$(cat /proc/cmdline)"
19 33
20 for x in ${CMDLINE} ; do 34 for x in ${CMDLINE} ; do
21 case "${x}" in 35 case "${x}" in
36 # We put nodetect first, so we can override it with do* commands
22 nodetect) 37 nodetect)
23 DETECT="no"
24 GPM="no"
25 HOTPLUG="no"
26 APM="no"
27 ACPI="no" 38 ACPI="no"
28 ALSA="no" 39 ALSA="no"
40 APM="no"
41 DETECT="no"
42 DMRAID="no"
43 EVMS="no"
44 FIREWIRE="no"
45 GPM="no"
46 HALD="no"
47 HOTPLUG="no"
48 LVM="no"
49 MDADM="no"
50 NET="no"
51 NFS="no"
52 PCMCIA="no"
53 PATA="no"
54 SATA="no"
55 SCSI="no"
56 USB="no"
29 X11="no" 57 X11="no"
58 ;;
59 noapm)
60 APM="no"
30 ;; 61 ;;
31 nodhcp) 62 nodhcp)
32 DHCP="no" 63 DHCP="no"
33 ;; 64 ;;
65 nodmraid)
66 DMRAID="no"
67 ;;
68 noevms|noevms2)
69 EVMS="no"
70 ;;
71 nofirewire)
72 FIREWIRE="no"
73 ;;
34 nogpm) 74 nogpm)
35 GPM="no" 75 GPM="no"
36 ;; 76 ;;
77 nohotplug)
78 HOTPLUG="no"
79 ;;
80 noload=*)
81 NOLOAD="$*"
82 ;;
83 nolvm|nolvm2)
84 LVM="no"
85 ;;
86 nomdadm)
87 MDADM="no"
88 ;;
89 nonet)
90 NET="no"
91 ;;
92 nonfs)
93 NFS="no"
94 ;;
95 nopata)
96 PATA="no"
97 ;;
98 nopcmcia)
99 PCMCIA="no"
100 ;;
101 nosata)
102 SATA="no"
103 ;;
104 noscsi)
105 SCSI="no"
106 ;;
107 nosshd)
108 SSHD="no"
109 ;;
110 nosound)
111 ALSA="no"
112 ;;
113 nousb)
114 USB="no"
115 nox)
116 X11="no"
117 ;;
118 ide\=nodma)
119 IDEDMA="no"
120 ;;
121 acpi\=on|acpi\=force)
122 ACPI="yes"
123 APM="no"
124 ;;
125 doapm)
126 ACPI="no"
127 APM="yes"
128 ;;
129 dodhcp)
130 DHCP="yes"
131 ;;
132 dodmraid)
133 DMRAID="yes"
134 ;;
135 doevms|doevms2)
136 EVMS="yes"
137 ;;
138 dofirewire)
139 FIREWIRE="yes"
140 ;;
141 dogpm)
142 GPM="yes"
143 ;;
144 dohotplug)
145 HOTPLUG="yes"
146 ;;
147 dolvm|dolvm2)
148 LVM="yes"
149 ;;
150 domdadm)
151 MDADM="yes"
152 ;;
153 donet)
154 NET="yes"
155 ;;
156 dopata)
157 PATA="yes"
158 ;;
37 dopcmcia) 159 dopcmcia)
38 PCMCIA="yes" 160 PCMCIA="yes"
39 ;; 161 ;;
40 doapm) 162 dosata)
41 APM="yes" 163 SATA="yes"
42 ACPI="no"
43 ;; 164 ;;
44 acpi=on|acpi=force) 165 doscsi)
45 APM="no"
46 ACPI="yes" 166 SCSI="yes"
47 ;; 167 ;;
48 ide=nodma) 168 dosshd)
49 IDEDMA="no" 169 SSHD="yes"
50 ;; 170 ;;
51 nohotplug)
52 HOTPLUG="no"
53 ;;
54 nosound) 171 dosound)
55 ALSA="no" 172 SOUND="yes"
56 ;; 173 ;;
174 dousb)
175 USE="yes"
176 ;;
57 nox) 177 dox)
58 X11="no" 178 X11="yes"
179 ;;
180 passwd=*)
181 PASSWD="no"
182 PASSWORD="$*"
59 ;; 183 ;;
60 esac 184 esac
61 done 185 done
62} 186}
63 187
64depend() { 188depend() {
65 need modules 189 need modules
66 before net 190 before net
67# provide gpm pcmcia apmd acpid coldplug hdparm alsasound x-setup
68} 191}
69 192
70# Checks whether a service will be started by autoconfig. 193# Checks whether a service will be started by autoconfig.
71# Usage: check_svc var service [service_alternative] 194# Usage: check_svc var service [service_alternative]
72check_svc() { 195check_svc() {
73 if [ "$1" = "yes" ] 196 if [ "${1}" = "yes" ]
74 then 197 then
75 if [ -x "/etc/init.d/$2" ] 198 if [ -x "/etc/init.d/${2}" ]
76 then 199 then
77 echo "$2" 200 echo "${2}"
78 elif [ -n "$3" -a -x "/etc/init.d/$3" ] 201 elif [ -n "${3}" -a -x "/etc/init.d/${3}" ]
79 then 202 then
80 echo "$3" 203 echo "${3}"
81 fi 204 fi
82 fi 205 fi
83} 206}
84 207
85# Prints an ordered list of services that will be started by autoconfig. 208# Prints an ordered list of services that will be started by autoconfig.
86list_services() { 209list_services() {
87 get_config 210 get_config
88 211
89 local svcs="$(check_svc ${APM} apmd)" 212 local svcs="$(check_svc ${ACPI} acpid)"
213 svcs="${svcs} $(check_svc ${ALSA} alsasound)"
90 svcs="${svcs} $(check_svc ${ACPI} acpid)" 214 svcs="${svcs} $(check_svc ${APM} apmd)"
215 svcs="${svcs} $(check_svc ${GPM} gpm)"
216 svcs="${svcs} $(check_svc ${HALD} hald)"
217 svcs="${svcs} $(check_svc ${HOTPLUG} coldplug hotplug)"
91 svcs="${svcs} $(check_svc ${IDEDMA} hdparm)" 218 svcs="${svcs} $(check_svc ${IDEDMA} hdparm)"
219 svcs="${svcs} $(check_svc ${NFS} nfsmount)"
220 svcs="${svcs} $(check_svc ${PASSWD} pwgen"
92 svcs="${svcs} $(check_svc ${PCMCIA} pcmcia)" 221 svcs="${svcs} $(check_svc ${PCMCIA} pcmcia)"
93 svcs="${svcs} $(check_svc ${GPM} gpm)"
94 svcs="${svcs} $(check_svc ${HOTPLUG} coldplug hotplug)"
95 svcs="${svcs} $(check_svc ${ALSA} alsasound)" 222 svcs="${svcs} $(check_svc ${SSH} sshd)"
223 svcs="${svcs} $(check_svc ${X11} mkxf86config x-setup)"
224
225 ### TODO: make this baselayout-2 compatible
226 ### TODO: make these checks accurate using service dependencies
96 227
97 echo ${svcs} 228 echo ${svcs}
98} 229}
99 230
100# Only used on SGI CDs, this determines: 231unpack_firmware() {
101# A) CPU Type 232 # This unpacks any firmware tarballs.
102# B) System 233 if [ -e /lib/firmware.tar.bz2 ]
234 then
235 ebegin "Unpacking hotplug firmware"
236 tar xjf /lib/firmware.tar.bz2 -C /lib/firmware
237 eend 0
238 fi
239}
240
241get_info() {
242 local tmp
243
244 if [ ! -z "${1}" -a ! -z "${2}" ]
245 then
246 tmp=$(grep "^$1[[:space:]]\+:" /proc/cpuinfo | head -n 1 | cut -d" " -f3-)
247 eval "${2}='${tmp}'"
248 fi
249}
250
103detect_mips() { 251detect_mips() {
104 local cpuinfo="$(awk -F: '/^cpu model/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1 | cut -d" " -f2,3)" 252 get_info "cpu model" cpuinfo
105 local machinfo="$(awk -F: '/^system type/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | cut -d" " -f2-)" 253 get_info "system type" machinfo
106 local machtype="" 254 cpuinfo="${cpuinfo%% FPU*}"
107 255
108 case "${machinfo}" in 256 case "${machinfo}" in
109 "SGI Indy")
110 machtype="SGI Indy" # Indy R4x00/R5000
111 ;;
112 "SGI Indigo2") 257 "SGI Indigo2")
113 case "${cpuinfo}" in 258 case "${cpuinfo}" in
114 R4*) 259 R4*)
115 machtype="SGI Indigo2" # I2 R4x00 260 machinfo="SGI Indigo2" # I2 R4x00
116 ;; 261 ;;
117 R8*) 262 R8*)
118 machtype="SGI Indigo2 Power" # I2 R8000 263 machinfo="SGI Indigo2 Power" # I2 R8000
119 ;; 264 ;;
120 R10*) 265 R10*)
121 machtype="SGI Indigo2 Impact" # I2 R10000 266 machinfo="SGI Indigo2 Impact" # I2 R10000
122 ;; 267 ;;
123 esac 268 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 ;; 269 ;;
137 esac 270 esac
138 271
139 PC="Detected an ${machtype} w/ ${numcpu} ${cpuinfo} ${bit}" 272 PC="Detected an ${machinfo} w/ ${numcpu} ${cpuinfo} CPU(s)"
140} 273}
141 274
142detect_x86_amd64() { 275detect_x86_amd64_ia64() {
143 local cpuinfo="$(awk -F: '/^model name/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 276 if [ "${1}" = "ia64" ]
144 local mhz="$(awk -F: '/^cpu MHz/{printf " %dMHz",int($2)};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 277 then
278 get_info "family" cpuinfo
279 else
280 get_info "model name" cpuinfo
281 fi
282 get_info "cpu MHz" mhz
283 mhz="${mhz%%.*}MHz"
145 284
146 PC="Detected ${numcpu} ${cpuinfo} ${mhz} ${bit}" 285 PC="Detected ${numcpu} ${cpuinfo} CPU(s) @ ${mhz}"
147} 286}
148 287
149detect_alpha() { 288detect_alpha() {
150 local cpuinfo="$(awk -F: '/^platform string/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 289 get_info "platform string" machinfo
151 local numcpu="$(awk -F: '/^cpus active/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 290 get_info "cpu" cpuinfo1
152 if [ "${numcpu}" -gt '1' ] 291 get_info "cpu model" cpuinfo2
153 then 292 get_info "cpus detected" numcpu
154 bit="CPUs" 293
155 else 294 PC="Detected ${numcpu} ${cpuinfo1} ${cpuinfo2} CPU(s) in a ${machinfo} system"
156 bit="CPU"
157 fi
158 PC="Detected ${numcpu} ${cpuinfo} ${bit}"
159} 295}
160 296
161detect_ppc() { 297detect_ppc() {
162 local cpuinfo="$(awk -F: '/^cpu/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 298 get_info "cpu" cpuinfo
163 local mhz="$(awk -F: '/^clock/{printf " %dMHz",int($2)};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | head -n 1)" 299 get_info "clock" mhz
164 local machinfo="$(awk -F: '/^detected as/{printf $2}' /proc/cpuinfo | cut -d'(' -f2 | cut -d')' -f1)" 300 get_info "detected as" machinfo
301 machinfo="${machinfo##*\(}"
302 machinfo="${machinfo%%\)*}"
303
165 local machtype="" 304 local machtype=""
166 # if [ -z "machinfo" ]
167 # then
168 # machinfo=$(awk -F: '/^machine/{printf $2}' /proc/cpuinfo)"
169 # fi
170 305
171 case "${machinfo}" in 306 case "${machinfo}" in
307 "CHRP Pegasos2")
308 machtype="Pegasos 2"
309 ;;
310 "CHRP IBM,9124-720")
311 machtype="IBM OP720"
312 ;;
313 "iBook 2 rev. 2")
314 machtype="Apple iBook G3"
315 ;;
316 "iMac G5"*)
317 machtype="Apple iMac G5"
318 ;;
319 "MPC8241")
320 machtype="Kurobox"
321 ;;
322 "PowerMac G5")
323 machtype="Apple PowerMac G5"
324 ;;
325 "PowerMac G5 Dual Core")
326 machtype="Apple PowerMac G5 Dual Core"
327 ;;
172 "PowerMac G4 AGP Graphics") 328 "PowerMac G4 AGP Graphics")
173 machtype="Apple PowerMac G4" 329 machtype="Apple PowerMac G4"
174 ;; 330 ;;
175 "PowerBook Titanium"|'PowerBook G4 15"') 331 "PowerBook Titanium"|'PowerBook G4 15"')
176 machtype="Apple Powerbook G4" 332 machtype="Apple Powerbook G4"
177 ;; 333 ;;
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") 334 "Unknown Intrepid-based")
188 machtype="Apple Mac-Mini" 335 machtype="Apple Mac-Mini"
189 ;; 336 ;;
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 *) 337 *)
200 machtype="Unknown PPC System" 338 machtype="Unknown PPC System"
201 ;; 339 ;;
202 esac 340 esac
203 341
204 PC="Detected an ${machtype} w/ ${numcpu} ${cpuinfo} ${bit}" 342 PC="Detected a(n) ${machtype} w/ ${numcpu} ${cpuinfo} CPU(s)"
343}
344
345detect_sparc() {
346 get_info "cpu" cpuinfo
347 get_info "ncpus active" numcpu
348 get_info "ncpus probed" numprobed
349
350 PC="Detected ${numcpu} active ${cpuinfo} CPU(s) of ${numprobed} total"
205} 351}
206 352
207start() { 353start() {
208 echo "0" > /proc/sys/kernel/printk 354 echo "0" > /proc/sys/kernel/printk
209 get_config 355 get_config
356
357 # First off, we want hotplug/coldplug enabled, so let's re-enable it.
358 # We do this even if we aren't starting up the hotplug/coldplug
359 # services for the installer.
360 sed -i 's/RC_COLDPLUG="no"/RC_COLDPLUG="yes"/' /etc/conf.d/rc
361 # Now, we check if we're supposed to run a coldplug script.
362 if [ "${HOTPLUG}" = "yes" ]
363 then
364 # Check whether we should be using hotplug/coldplug or whether we should
365 # just let udev do it all.
366 if [ -x /etc/init.d/coldplug ]
367 then
368 start_service coldplug
369 elif [ -x /etc/init.d/hotplug ]
370 then
371 start_service hotplug
372 else
373 unpack_firmware
374 [ -x /sbin/udevtrigger ] && /sbin/udevtrigger
375 fi
376 else
377 ewarn "Hotplug/Coldplug disabled via cmdline ..."
378 fi
379
210 if [ "${DETECT}" = "yes" ] 380 if [ "${DETECT}" = "yes" ]
211 then 381 then
212 ebegin "Hardware detection started" 382 ebegin "Hardware detection started"
213 local numcpu="$(awk -F: '/^processor/{printf $2};/^$/{print ""}' /proc/cpuinfo 2>/dev/null | wc -l)" 383 local numcpu="$(grep -c '^processor[[:space:]]\+:' /proc/cpuinfo)"
214 local arch="$(uname -m)" 384 local arch="$(uname -m)"
215 local ismips="no" 385
216 if [ "${numcpu}" -gt '1' ]
217 then
218 bit="CPUs"
219 else
220 bit="CPU"
221 fi
222 case ${arch} in 386 case ${arch} in
223 mips|mips64) 387 mips*)
224 detect_mips 388 detect_mips
225 ismips="yes" 389 ACPI="no"
390 APM="no"
391 IDEDMA="no"
226 ;; 392 ;;
227 i?86|x86_64) 393 i?86|x86_64)
228 detect_x86_amd64 394 detect_x86_amd64_ia64
229 ;; 395 ;;
230 alpha) 396 alpha)
231 detect_alpha 397 detect_alpha
398 ACPI="no"
399 APM="no"
400 ;;
401 sparc*)
402 detect_sparc
403 ACPI="no"
404 APM="no"
232 ;; 405 ;;
233 powerpc*) 406 powerpc*)
234 detect_ppc 407 detect_ppc
408 ACPI="no"
409 APM="no"
410 ;;
411 ia64)
412 detect_x86_amd64_ia64 "ia64"
413 APM="no"
235 ;; 414 ;;
236 *) 415 *)
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)" 416 PC=
238 ;; 417 ;;
239 esac 418 esac
240 einfo "${PC}" 419 [ -n "${PC}" ] && einfo "${PC}"
241 [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null 420 [ -x /usr/sbin/hwsetup ] && hwsetup
242 eend 421 eend
243 else 422 else
244 ewarn "Hardware detection disabled via cmdline ..." 423 ewarn "Hardware detection disabled via cmdline ..."
245 fi 424 fi
246 425
248 then 427 then
249 modprobe apm power_off=1 >/dev/null 2>&1 && \ 428 modprobe apm power_off=1 >/dev/null 2>&1 && \
250 einfo "APM BIOS found, power management functions enabled ..." 429 einfo "APM BIOS found, power management functions enabled ..."
251 [ -x /etc/init.d/apmd ] && start_service apmd 430 [ -x /etc/init.d/apmd ] && start_service apmd
252 else 431 else
253 [ "${ismips}" = "no" ] && ewarn "Not Loading APM Bios support ..." 432 einfo "Not Loading APM Bios support ..."
254 fi 433 fi
255 434
256 if [ "${ACPI}" = "yes" ] 435 if [ "${ACPI}" = "yes" ]
257 then 436 then
258 modprobe processor >/dev/null 2>&1 && \ 437 modprobe processor >/dev/null 2>&1 && \
260 modprobe thermal >/dev/null 439 modprobe thermal >/dev/null
261 modprobe fan >/dev/null 2>&1 440 modprobe fan >/dev/null 2>&1
262 modprobe button >/dev/null 2>&1 441 modprobe button >/dev/null 2>&1
263 modprobe battery >/dev/null 2>&1 442 modprobe battery >/dev/null 2>&1
264 modprobe ac >/dev/null 2>&1 443 modprobe ac >/dev/null 2>&1
444 modprobe thermal >/dev/null 2>&1
445 modprobe video >/dev/null 2>&1
446 modprobe dock >/dev/null 2>&1
265 [ -x /etc/init.d/acpid ] && start_service acpid 447 [ -x /etc/init.d/acpid ] && start_service acpid
266 eend 448 eend
267 else 449 else
268 [ "${ismips}" = "no" ] && ewarn "Not Loading ACPI support ..." 450 einfo "Not Loading ACPI support ..."
269 fi 451 fi
270 452
271 if [ "${IDEDMA}" = "yes" ] 453 if [ "${IDEDMA}" = "yes" ]
272 then 454 then
273 if [ "${ismips}" = "no" ]; then
274 [ -x /etc/init.d/hdparm ] && start_service hdparm 455 [ -x /etc/init.d/hdparm ] && start_service hdparm
275 fi 456 else
457 ewarn "Disabling IDE DMA support ..."
276 fi 458 fi
277 459
278 if [ "${PCMCIA}" = "yes" ] 460 if [ "${PCMCIA}" = "yes" ]
279 then 461 then
280 einfo "PCMCIA enabled via cmdline ..."
281 [ -x /etc/init.d/pcmcia ] && start_service pcmcia 462 [ -x /etc/init.d/pcmcia ] && start_service pcmcia
463 else
464 ewarn "PCMCIA disabled via cmdline ..."
282 fi 465 fi
283 466
284 if [ "${DHCP}" = "no" ] 467 if [ "${DHCP}" = "no" ]
285 then 468 then
286 sed -i -e '/^ifconfig_eth.*dhcp.*/ s/^/#/' \ 469 sed -i -e '/^ifconfig_eth.*dhcp.*/ s/^/#/' \
287 -e '/^iface_eth.*dhcp.*/ s/^/#/' \ 470 -e '/^iface_eth.*dhcp.*/ s/^/#/' \
288 -e '/^config_eth.*dhcp.*/ s/^/#/' \ 471 -e '/^config_eth.*dhcp.*/ s/^/#/' \
289 /etc/conf.d/net 472 /etc/conf.d/net
290 ewarn "Skipping DHCP broadcast detection as requested on boot commandline ..." 473 for i in `seq 0 4`
474 do
475 echo "config_eth${i}=( \"none\" )" >> /etc/conf.d/net
476 done
477 ewarn "Skipping DHCP broadcast ..."
291 fi 478 fi
292 479
293 # Read in what hwsetup has found 480 # Read in what hwsetup has found
294 [ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix
295 [ -f /etc/sysconfig/gentoo ] && . /etc/sysconfig/gentoo 481 [ -f /etc/sysconfig/gentoo ] && source /etc/sysconfig/gentoo
296 482
297 # Mouse 483 # Mouse
298 if [ -n "${MOUSE_DEVICE}" ] 484 if [ -n "${MOUSE_DEVICE}" ]
299 then 485 then
300 einfo "Mouse is ${HILITE}${MOUSE_FULLNAME}${NORMAL} at ${HILITE}${MOUSE_DEVICE}${NORMAL} ..." 486 einfo "Mouse is ${HILITE}${MOUSE_FULLNAME}${NORMAL} at ${HILITE}${MOUSE_DEVICE}${NORMAL} ..."
301 source /etc/sysconfig/mouse 487 source /etc/sysconfig/mouse
302 if [ -x /usr/sbin/gpm ] 488 if [ -x /usr/sbin/gpm ]
303 then 489 then
304 [ $(grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm) ] \ 490 if [ $(grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm) ]
491 then
305 && sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm \ 492 sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm
493 else
306 || echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm 494 echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm
495 fi
307 496
308 [ $(grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm) ] \ 497 if [ $(grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm) ]
498 then
309 && sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm \ 499 sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm
500 else
310 || echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm 501 echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm
502 fi
311 503
312 [ "${GPM}" = "yes" ] \ 504 [ "${GPM}" = "yes" ] \
313 && [ -x /etc/init.d/gpm ] && start_service gpm 505 && [ -x /etc/init.d/gpm ] && start_service gpm
314 fi 506 fi
315 fi
316
317 if [ "${HOTPLUG}" = "yes" ]
318 then
319 # Check whether we should be using hotplug or coldplug
320 if [ -x /etc/init.d/coldplug ]
321 then
322 start_service coldplug
323 elif [ -x /etc/init.d/hotplug ]
324 then
325 start_service hotplug
326 fi
327 else
328 ewarn "Hotplug disabled via cmdline ..."
329 fi 507 fi
330 508
331 [ "${DETECT}" = "no" ] && DHCP="no" 509 [ "${DETECT}" = "no" ] && DHCP="no"
332 [ "${DETECT}" = "yes" ] \ 510 [ "${DETECT}" = "yes" ] \
333 && NETDEVICES="$(awk -F: '/eth.:|tr.:|ath.:|wlan.:/{print $1}' /proc/net/dev 2>/dev/null)" 511 && NETDEVICES="$(awk -F: '/eth.:|tr.:|ath.:|wlan.:/{print $1}' /proc/net/dev 2>/dev/null)"
337 for nics in ${NETDEVICES} 515 for nics in ${NETDEVICES}
338 do 516 do
339 if [ "${DHCP}" = "yes" ] 517 if [ "${DHCP}" = "yes" ]
340 then 518 then
341 einfo "Network device ${HILITE}${nics}${NORMAL} detected, DHCP broadcasting for IP ..." 519 einfo "Network device ${HILITE}${nics}${NORMAL} detected, DHCP broadcasting for IP ..."
520 if [ -f /var/run/dhcpcd-${nics}.pid ]
521 then
522 if [ -z "$(/sbin/ifconfig ${nics} | grep 'inet addr')" ]
523 then
524 kill $(cat /var/run/dhcpcd-${nics}.pid)
525 sleep 2
342 dhcpcd -n -h $(hostname) & 526 dhcpcd -n -h $(hostname) ${nics}
527 fi
528 fi
343 fi 529 fi
344 done 530 done
531 [ "${NFS}" = "yes" ] \
532 && [ -x /etc/init.d/nfsmount ] && start_service nfsmount
533 if [ "${PASSWD}" = "no" ]
534 then
535 echo "root:${PASSWORD}" | chpasswd > /dev/null 2>&1
536 else
537 start_service pwgen
538 fi
539 if [ "${SSHD}" = "yes" ]
540 then
541 # If we have passwd= on the command line, we don't run pwgen and we
542 # set the root password to PASSWORD.
543 if [ "${PASSWD}" = "yes" ]
544 then
545 ewarn "WARNING: You are starting sshd with a scrambled root password!!!"
546 ewarn "WARNING: You need to set a root password to be able to login remotely."
547 fi
548 [ -x /etc/init.d/sshd ] && start_service sshd
549 fi
345 else 550 else
346 ewarn "No Network device auto detected ..." 551 ewarn "No Network device auto detected ..."
347 fi 552 fi
348 553
349 if [ "${ALSA}" = "yes" ] 554 if [ "${ALSA}" = "yes" ]
357 [ -n "${SOUND_DRIVER}" ] \ 562 [ -n "${SOUND_DRIVER}" ] \
358 && sndmsg="${sndmsg} driver = ${SOUND_DRIVER}\n" 563 && sndmsg="${sndmsg} driver = ${SOUND_DRIVER}\n"
359 564
360 einfo "${sndmsg}" 565 einfo "${sndmsg}"
361 566
362
363 if [ -x /etc/init.d/alsasound ] 567 if [ -x /etc/init.d/alsasound ]
364 then 568 then
365 start_service alsasound 569 start_service alsasound
366 fi 570 fi
367 571
368 if [ -e /proc/asound/cards ] 572 if [ -e /proc/asound/cards ]
369 then 573 then
370 for i in $(cat /proc/asound/cards | cut -d" " -f1) 574 for i in $(cat /proc/asound/cards | awk '{print $1}' | grep ^[[:digit:]])
371 do 575 do
372 if [ -d /proc/asound/card$i ] && [ -x /usr/bin/amixer ] 576 if [ -d /proc/asound/card$i ] && [ -x /usr/bin/amixer ]
373 then 577 then
374 amixer -c $i scontrols > /etc/amixer 578 amixer -c $i scontrols > /etc/amixer
375 [ -n "$(grep Master /etc/amixer)" ] \ 579 [ -n "$(grep Master /etc/amixer)" ] \
393 fi 597 fi
394 else 598 else
395 ewarn "Skipping ALSA detection as requested on command line ..." 599 ewarn "Skipping ALSA detection as requested on command line ..."
396 fi 600 fi
397 601
398 if [ "${DETECT}" = "yes" ]
399 then
400 [ -x /etc/init.d/x-setup ] && start_service x-setup
401 fi
402
403 [ "${X11}" = "no" ] && touch /etc/init.d/.noxdm
404 [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}" 602 [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}"
603
604 if [ "${X11}" = "yes" ]
605 then
606 if [ -x /etc/init.d/mkxf86config ]
607 then
608 start_service mkxf86config
609 fi
610 if [ -x /etc/init.d/x-setup ]
611 then
612 start_service x-setup
613 fi
614 else
615 touch /etc/init.d/.noxdm
616 fi
405 617
406 killall hwsetup 2>/dev/null 618 killall hwsetup 2>/dev/null
407 echo "6" > /proc/sys/kernel/printk 619 echo "6" > /proc/sys/kernel/printk
408} 620}
409 621

Legend:
Removed from v.98  
changed lines
  Added in v.141

  ViewVC Help
Powered by ViewVC 1.1.20