/[livecd-tools]/trunk/autoconfig
Gentoo

Diff of /trunk/autoconfig

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

Revision 4 Revision 6
1#!/sbin/runscript 1#!/sbin/runscript
2# Copyright 1999-2002 Gentoo Technologies, Inc. 2# Copyright 1999-2002 Gentoo Technologies, Inc.
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.2 2004/04/30 22:52:02 zhen Exp $ 4# $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.3 2004/07/11 23:33:45 wolf31o2 Exp $
5 5
6echo "0" > /proc/sys/kernel/printk 6echo "0" > /proc/sys/kernel/printk
7DHCP="yes" 7DHCP="yes"
8DETECT="yes" 8DETECT="yes"
9PCMCIA="no" 9PCMCIA="no"
10HOTPLUG="yes" 10HOTPLUG="yes"
11APM="no" 11APM="no"
12ACPI="no" 12ACPI="no"
13CMDLINE="`cat /proc/cmdline`" 13CMDLINE="`cat /proc/cmdline`"
14for x in $CMDLINE 14for x in $CMDLINE ; do
15do
16 if [ "$x" = "nodetect" ] 15 if [ "$x" = "nodetect" ]; then
17 then
18 DETECT="no" 16 DETECT="no"
19 HOTPLUG="no" 17 HOTPLUG="no"
20 APM="no" 18 APM="no"
21 ACPI="no" 19 ACPI="no"
22 fi 20 fi
23 21
24 if [ "$x" = "nodhcp" ] 22 if [ "$x" = "nodhcp" ]; then
25 then
26 DHCP="no" 23 DHCP="no"
27 fi 24 fi
28 25
29 if [ "$x" = "dopcmcia" ] 26 if [ "$x" = "dopcmcia" ]; then
30 then
31 PCMCIA="yes" 27 PCMCIA="yes"
32 fi 28 fi
33 29
34 if [ "$x" = "doapm" ] 30 if [ "$x" = "doapm" ]; then
35 then
36 APM="yes" 31 APM="yes"
37 fi 32 fi
38 33
39 if [ "$x" = "acpi=on" ] 34 if [ "$x" = "acpi=on" ]; then
40 then
41 APM="no" 35 APM="no"
42 ACPI="yes" 36 ACPI="yes"
43 fi 37 fi
44done 38done
45 39
46depend() { 40depend() {
47 need modules 41 need modules
48} 42}
49 43
50start() { 44start() {
51if [ "$DETECT" = "yes" ] 45 if [ "$DETECT" = "yes" ]; then
52 then
53 ebegin $WARN"Hardware detection started" 46 ebegin $WARN"Hardware detection started"
54 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` 47 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`
55 ebegin $GOOD"$PC" 48 ebegin $GOOD"$PC"
56 eend 49 eend
57 hwsetup -p >/dev/null 50 hwsetup -p >/dev/null
58 eend 51 eend
59 else 52 else
60 ebegin $WARN"Hardware detection disabled via cmdline$NORMAL" 53 ebegin $WARN"Hardware detection disabled via cmdline$NORMAL"
61fi 54 fi
62 55
63if [ "$APM" = "yes" ] 56 if [ "$APM" = "yes" ]; then
64 then
65 insmod apm power_off=1 >/dev/null 2>&1 && ebegin $GOOD"APM BIOS found, power management functions enabled.$NORMAL" 57 insmod apm power_off=1 >/dev/null 2>&1 && ebegin $GOOD"APM BIOS found, power management functions enabled.$NORMAL"
66 /etc/init.d/apmd start 58 /etc/init.d/apmd start
67 else 59 else
68 ebegin $GOOD"Not Loading APM Bios support.${NORMAL}" 60 ebegin $GOOD"Not Loading APM Bios support.${NORMAL}"
69 eend 61 eend
70fi 62 fi
71 63
72if [ "$ACPI" = "yes" ] 64 if [ "$ACPI" = "yes" ]; then
73then
74 insmod processor >/dev/null 2>&1 && ebegin $GOOD ACPI power management functions enabled.$NORMAL 65 insmod processor >/dev/null 2>&1 && ebegin $GOOD ACPI power management functions enabled.$NORMAL
75 insmod fan >/dev/null 66 insmod fan >/dev/null
76 insmod thermal >/dev/null 67 insmod thermal >/dev/null
77 insmod button >/dev/null 68 insmod button >/dev/null
78 insmod battery >/dev/null 69 insmod battery >/dev/null
79 insmod ac >/dev/null 70 insmod ac >/dev/null
80 /etc/init.d/acpid start 71 /etc/init.d/acpid start
81 eend 72 eend
82fi 73 fi
83 74
84if [ "$PCMCIA" = "yes" ] 75 if [ "$PCMCIA" = "yes" ]; then
85 then
86 ebegin $HILITE "PCMCIA enabled via cmdline" 76 ebegin $HILITE "PCMCIA enabled via cmdline"
87 /etc/init.d/pcmcia start 77 /etc/init.d/pcmcia start
88fi 78 fi
89 79
90if [ "$DHCP" = "no" ] 80 if [ "$DHCP" = "no" ]; then
91 then
92 sed 's/iface_eth0="dhcp"/#iface_eth0="dhcp"/' /etc/conf.d/net > /etc/conf.d/net1 81 sed 's/iface_eth0="dhcp"/#iface_eth0="dhcp"/' /etc/conf.d/net > /etc/conf.d/net1
93 cp /etc/conf.d/net1 /etc/conf.d/net 82 cp /etc/conf.d/net1 /etc/conf.d/net
94 rm /etc/conf.d/net1 83 rm /etc/conf.d/net1
95 ebegin $BAD"Skipping DHCP broadcast detection as requested on boot commandline." 84 ebegin $BAD"Skipping DHCP broadcast detection as requested on boot commandline."
96fi 85 fi
97 86
98 #Read in what hwsetup has found 87 #Read in what hwsetup has found
99[ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix 88 [ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix
100 89
101# Mouse 90 # Mouse
102if [ -n "$MOUSE_DEVICE" ] 91 if [ -n "$MOUSE_DEVICE" ]; then
103 then
104 ebegin $GOOD"Mouse is $HILITE$MOUSE_FULLNAME$GOOD at $HILITE$MOUSE_DEVICE$NORMAL" 92 ebegin $GOOD"Mouse is $HILITE$MOUSE_FULLNAME$GOOD at $HILITE$MOUSE_DEVICE$NORMAL"
105 source /etc/sysconfig/mouse 93 source /etc/sysconfig/mouse
106 gpm -m "${MOUSE_DEVICE}" -t "${MOUSETYPE}" 94 [ -x /usr/sbin/gpm ] && gpm -m "${MOUSE_DEVICE}" -t "${MOUSETYPE}"
107 eend 95 eend
108fi 96 fi
109 97
110if [ "$HOTPLUG" = "yes" ] 98 if [ "$HOTPLUG" = "yes" ]; then
111 then
112 /etc/init.d/hotplug start 99 /etc/init.d/hotplug start
113 else 100 else
114 ebegin $BAD"Hotplug disabled via cmdline$NORMAL" 101 ebegin $BAD"Hotplug disabled via cmdline$NORMAL"
115fi 102 fi
116 103
117if [ "$DETECT" = "no" ] 104 if [ "$DETECT" = "no" ]; then
118 then
119 DHCP="no" 105 DHCP="no"
106 fi
120 107
108 if [ "$DETECT" = "yes" ]; then
109 NETDEVICES="`awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null`"
121fi 110 fi
122 111
123if [ "$DETECT" = "yes" ] 112 if [ -n "$NETDEVICES" ]; then
124 then 113 if [ "${DHCP}" = "yes" ]; then
125 NETDEVICES="`awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null`" 114 ebegin $GOOD"Network device$HILITE$NETDEVICES$GOOD detected,$WARN DHCP broadcasting for IP.$NORMAL"
126fi 115 dhcpcd
116 fi
117 eend
127 118
128if [ -n "$NETDEVICES" ]
129 then
130 ebegin $GOOD"Network device$HILITE$NETDEVICES$GOOD detected,$WARN DHCP broadcasting for IP.$NORMAL"
131 if [ "${DHCP}" = "yes" ]
132 then
133 dhcpcd
134 fi
135 eend
136
137 else 119 else
138 ebegin $BAD"No Network device auto detected.$NORMAL" 120 ebegin $BAD"No Network device auto detected.$NORMAL"
139
140fi 121 fi
141 122
142 123
143if [ -n "$SOUND_FULLNAME" -o -n "$SOUND_DRIVER" ] 124 if [ -n "$SOUND_FULLNAME" -o -n "$SOUND_DRIVER" ]; then
144 then
145 # Setting micro input to zero to avoid subsonic disaster
146 ebegin $GOOD"Soundcard:" 125 ebegin $GOOD"Soundcard:"
147 eend 126 eend
148 aumix -m 0 >/dev/null 2>&1 127 if [ -d /proc/asound/card0 ] && [ -x /usr/bin/amixer ]; then
149 aumix -f /etc/aumixrc -L >/dev/null 2>&1 128 amixer scontrols > /etc/amixer
150 aumix -v75 -c75 -w75 >/dev/null 2>&1 129 [ -n "`grep Master /etc/amixer`" ] && amixer set Master 75% \
151# modprobe /dev/dsp 130 && amixer set Master unmute
131 [ -n "`grep PCM /etc/amixer`" ] && amixer set PCM 75% \
132 && amixer set PCM unmute
133 [ -n "`grep Mic /etc/amixer`" ] && amixer set Mic 75% \
134 && amixer set Mic cap
135 [ -n "`grep Wave /etc/amixer`" ] && amixer set Wave 75% \
136 && amixer set Wave unmute
137 [ -n "`grep Capture /etc/amixer`" ] && amixer set Capture 75% \
138 && amixer set Capture cap && amixer set Capture unmute
139 fi
152 [ -n "$SOUND_FULLNAME" ] 140 [ -n "$SOUND_FULLNAME" ]
153 ebegin " $WARN$SOUND_FULLNAME" 141 ebegin " $WARN$SOUND_FULLNAME"
154 [ -n "$SOUND_DRIVER" ] 142 [ -n "$SOUND_DRIVER" ]
155 ebegin $WARN" driver = $SOUND_DRIVER"$HILITE 143 ebegin $WARN" driver = $SOUND_DRIVER"$HILITE
156fi 144 fi
157 145
158 146
159if [ -n "$XDESC" -o -n "$XDESC" ] 147 if [ -n "$XDESC" -o -n "$XDESC" ]; then
160 then
161 ebegin $GOOD"VideoCard: $WARN ${XDESC}" 148 ebegin $GOOD"VideoCard: $WARN ${XDESC}"
162 eend 149 eend
163fi 150 fi
164 151
165killall hwsetup 2>/dev/null 152 killall hwsetup 2>/dev/null
166echo "6" > /proc/sys/kernel/printk 153 echo "6" > /proc/sys/kernel/printk
167 154
168} 155}
156
157# vim: ts=4

Legend:
Removed from v.4  
changed lines
  Added in v.6

  ViewVC Help
Powered by ViewVC 1.1.20