/[livecd-tools]/trunk/autoconfig
Gentoo

Contents of /trunk/autoconfig

Parent Directory Parent Directory | Revision Log Revision Log


Revision 68 - (hide annotations) (download)
Fri Jul 8 18:59:36 2005 UTC (12 years, 3 months ago) by wolf31o2
File size: 5751 byte(s)
Added ALSA detection and nosound boot option.

1 zhen 2 #!/sbin/runscript
2 wolf31o2 44 # Copyright 1999-2005 Gentoo Foundation
3 zhen 2 # Distributed under the terms of the GNU General Public License v2
4 wolf31o2 68 # $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.34 2005/07/08 18:59:36 wolf31o2 Exp $
5 zhen 4
6 zhen 2 DHCP="yes"
7     DETECT="yes"
8 wolf31o2 24 GPM="yes"
9 zhen 2 PCMCIA="no"
10     HOTPLUG="yes"
11     APM="no"
12     ACPI="no"
13 wolf31o2 49 IDEDMA="yes"
14 wolf31o2 68 ALSA="yes"
15 wolf31o2 51
16 wolf31o2 68 get_config() {
17     echo "0" > /proc/sys/kernel/printk
18     CMDLINE="$(cat /proc/cmdline)"
19 wolf31o2 51
20 wolf31o2 68 for x in ${CMDLINE} ; do
21     if [ "${x}" = "nodetect" ]
22     then
23     DETECT="no"
24     GPM="no"
25     HOTPLUG="no"
26     APM="no"
27     ACPI="no"
28     ALSA="no"
29     fi
30 zhen 2
31 wolf31o2 68 if [ "${x}" = "nodhcp" ]
32     then
33     DHCP="no"
34     fi
35 zhen 4
36 wolf31o2 68 if [ "${x}" = "nogpm" ]
37     then
38     GPM="no"
39     fi
40 wolf31o2 31
41 wolf31o2 68 if [ "${x}" = "dopcmcia" ]
42     then
43     PCMCIA="yes"
44     fi
45 zhen 4
46 wolf31o2 68 if [ "${x}" = "doapm" ]
47     then
48     APM="yes"
49     ACPI="no"
50     fi
51 zhen 4
52 wolf31o2 68 if [ "${x}" = "acpi=on" -o "${x}" = "acpi=force" ]
53     then
54     APM="no"
55     ACPI="yes"
56     fi
57 wolf31o2 10
58 wolf31o2 68 if [ "${x}" = "ide=nodma" ]
59     then
60     IDEDMA="no"
61     fi
62 wolf31o2 49
63 wolf31o2 68 if [ "${x}" = "nohotplug" ]
64     then
65     HOTPLUG="no"
66     fi
67 zhen 2
68 wolf31o2 68 if [ "${x}" = "nosound" ]
69     then
70     ALSA="no"
71     fi
72     done
73     }
74    
75 zhen 2 depend() {
76     need modules
77 wolf31o2 50 before net
78 wolf31o2 68 # provide gpm pcmcia apmd acpid coldplug hdparm alsasound
79 zhen 2 }
80    
81     start() {
82 wolf31o2 68 get_config
83 wolf31o2 51 if [ "${DETECT}" = "yes" ]
84     then
85 wolf31o2 18 ebegin ${WARN}"Hardware detection started"
86 wolf31o2 51 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)
87 wolf31o2 18 ebegin ${GOOD}"${PC}"
88 zhen 2 eend
89 wolf31o2 14 [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null
90 zhen 2 eend
91 wolf31o2 6 else
92 wolf31o2 18 ebegin ${WARN}"Hardware detection disabled via cmdline$NORMAL"
93 wolf31o2 6 fi
94 zhen 2
95 wolf31o2 51 if [ "${APM}" = "yes" ]
96     then
97 wolf31o2 29 modprobe apm power_off=1 >/dev/null 2>&1 && ebegin ${GOOD}"APM BIOS found, power management functions enabled.${NORMAL}"
98 wolf31o2 67 [ -x /etc/init.d/apmd ] && schedule_service_startup apmd
99 zhen 2 else
100 wolf31o2 18 ebegin ${GOOD}"Not Loading APM Bios support.${NORMAL}"
101 wolf31o2 6 eend
102     fi
103 zhen 2
104 wolf31o2 51 if [ "${ACPI}" = "yes" ]
105     then
106 wolf31o2 29 modprobe processor >/dev/null 2>&1 && ebegin ${GOOD} ACPI power management functions enabled.${NORMAL} && modprobe thermal >/dev/null
107     modprobe fan >/dev/null 2>&1
108     modprobe button >/dev/null 2>&1
109     modprobe battery >/dev/null 2>&1
110     modprobe ac >/dev/null 2>&1
111 wolf31o2 67 [ -x /etc/init.d/acpid ] && schedule_service_startup acpid
112 wolf31o2 6 eend
113     fi
114 zhen 2
115 wolf31o2 51 if [ "${IDEDMA}" = "yes" ]
116     then
117 wolf31o2 67 [ -x /etc/init.d/hdparm ] && schedule_service_startup hdparm
118 wolf31o2 49 fi
119    
120 wolf31o2 51 if [ "${PCMCIA}" = "yes" ]
121     then
122 wolf31o2 18 ebegin ${HILITE} "PCMCIA enabled via cmdline"
123 wolf31o2 67 [ -x /etc/init.d/pcmcia ] && schedule_service_startup pcmcia
124 wolf31o2 6 fi
125 zhen 2
126 wolf31o2 51 if [ "${DHCP}" = "no" ]
127     then
128 wolf31o2 48 sed -i -e '/^ifconfig_eth.*dhcp.*/ s/^/#/' \
129     -e '/^iface_eth.*dhcp.*/ s/^/#/' \
130 wolf31o2 55 -e '/^config_eth.*dhcp.*/ s/^/#/' \
131 wolf31o2 25 /etc/conf.d/net
132 wolf31o2 18 ebegin ${BAD}"Skipping DHCP broadcast detection as requested on boot commandline."
133 wolf31o2 6 fi
134 zhen 2
135 wolf31o2 6 #Read in what hwsetup has found
136     [ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix
137 wolf31o2 64 [ -f /etc/sysconfig/gentoo ] && . /etc/sysconfig/gentoo
138 zhen 2
139 wolf31o2 6 # Mouse
140 wolf31o2 51 if [ -n "${MOUSE_DEVICE}" ]
141     then
142 wolf31o2 18 ebegin ${GOOD}"Mouse is ${HILITE}${MOUSE_FULLNAME}${GOOD} at ${HILITE}${MOUSE_DEVICE}${NORMAL}"
143 wolf31o2 6 source /etc/sysconfig/mouse
144 wolf31o2 51 if [ -x /usr/sbin/gpm ]
145     then
146     if [ $(grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm) ]
147     then
148 wolf31o2 24 sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm
149     else
150     echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm
151     fi
152 wolf31o2 51 if [ $(grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm) ]
153     then
154 wolf31o2 24 sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm
155     else
156     echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm
157     fi
158 wolf31o2 51 if [ "${GPM}" = "yes" ]
159     then
160 wolf31o2 67 [ -x /etc/init.d/gpm ] && schedule_service_startup gpm
161 wolf31o2 24 fi
162 wolf31o2 29 fi
163 wolf31o2 6 eend
164     fi
165 zhen 2
166 wolf31o2 51 if [ "${HOTPLUG}" = "yes" ]
167     then
168 wolf31o2 17 #Check whether we should be using hotplug or coldplug
169 wolf31o2 51 if [ -x /etc/init.d/coldplug ]
170     then
171 wolf31o2 67 schedule_service_startup coldplug
172     elif [ -x /etc/init.d/hotplug ]
173     then
174     schedule_service_startup hotplug
175 wolf31o2 17 fi
176 zhen 2 else
177 wolf31o2 18 ebegin ${BAD}"Hotplug disabled via cmdline${NORMAL}"
178 wolf31o2 6 fi
179 zhen 2
180 wolf31o2 51 if [ "${DETECT}" = "no" ]
181     then
182 wolf31o2 6 DHCP="no"
183     fi
184 zhen 2
185 wolf31o2 51 if [ "${DETECT}" = "yes" ]
186     then
187 wolf31o2 61 NETDEVICES="$(awk -F: '/eth.:|tr.:|ath.:|wlan.:/{print $1}' /proc/net/dev 2>/dev/null)"
188 wolf31o2 6 fi
189 zhen 2
190 wolf31o2 51 if [ -n "${NETDEVICES}" ]
191     then
192     if [ "${DHCP}" = "yes" ]
193     then
194 wolf31o2 18 ebegin ${GOOD}"Network device${HILITE}${NETDEVICES}${GOOD} detected,${WARN} DHCP broadcasting for IP.${NORMAL}"
195 wolf31o2 47 dhcpcd -h $(hostname) &
196 wolf31o2 6 fi
197     eend
198 zhen 2
199     else
200 wolf31o2 18 ebegin ${BAD}"No Network device auto detected.${NORMAL}"
201 wolf31o2 6 fi
202 zhen 2
203 wolf31o2 68 if [ "${ALSA}" = "yes" ]
204 wolf31o2 51 then
205 wolf31o2 68 if [ -n "${SOUND_FULLNAME}" -o -n "${SOUND_DRIVER}" ]
206 wolf31o2 51 then
207 wolf31o2 68 ebegin ${GOOD}"Soundcard:"
208     eend
209     [ -n "${SOUND_FULLNAME}" ]
210     ebegin " ${WARN}${SOUND_FULLNAME}"
211     [ -n "${SOUND_DRIVER}" ]
212     ebegin ${WARN}" driver = ${SOUND_DRIVER}"${HILITE}
213     schedule_service_startup alsasound
214     if [ -d /proc/asound/card0 ] && [ -x /usr/bin/amixer ]
215 wolf31o2 26 then
216 wolf31o2 68 amixer scontrols > /etc/amixer
217     if [ -n "$(grep Master /etc/amixer)" ]
218     then
219     amixer -q set Master 95% unmute >/dev/null 2>&1
220     fi
221     if [ -n "$(grep PCM /etc/amixer)" ]
222     then
223     amixer -q set PCM 95% unmute >/dev/null 2>&1
224     fi
225     if [ -n "$(grep Mic /etc/amixer)" ]
226     then
227     amixer -q set Mic 95% mute cap >/dev/null 2>&1
228     fi
229     if [ -n "$(grep Wave /etc/amixer)" ]
230     then
231     amixer -q set Wave 95% unmute >/dev/null 2>&1
232     fi
233     if [ -n "$(grep Capture /etc/amixer)" ]
234     then
235     amixer -q set Capture 95% unmute cap >/dev/null 2>&1
236     fi
237 wolf31o2 26 fi
238 wolf31o2 15 fi
239 wolf31o2 68 else
240     ebegin ${BAD}"Skipping ALSA detection as requested on boot commandline."
241 wolf31o2 6 fi
242 zhen 2
243 wolf31o2 51 if [ -n "${XDESC}" -o -n "${XDESC}" ]
244     then
245 wolf31o2 18 ebegin ${GOOD}"VideoCard: ${WARN} ${XDESC}"
246 zhen 2 eend
247 wolf31o2 6 fi
248 zhen 2
249 wolf31o2 6 killall hwsetup 2>/dev/null
250     echo "6" > /proc/sys/kernel/printk
251 zhen 4
252 zhen 2 }
253 wolf31o2 6
254     # vim: ts=4

Properties

Name Value
svn:eol-style native
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20