/[livecd-tools]/trunk/autoconfig
Gentoo

Diff of /trunk/autoconfig

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

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

Legend:
Removed from v.49  
changed lines
  Added in v.64

  ViewVC Help
Powered by ViewVC 1.1.20