/[livecd-tools]/trunk/autoconfig
Gentoo

Diff of /trunk/autoconfig

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

Revision 49 Revision 61
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.31 2005/06/22 15:35:14 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
110 128
111 # Mouse 129 # Mouse
112 if [ -n "${MOUSE_DEVICE}" ]; then 130 if [ -n "${MOUSE_DEVICE}" ]
131 then
113 ebegin ${GOOD}"Mouse is ${HILITE}${MOUSE_FULLNAME}${GOOD} at ${HILITE}${MOUSE_DEVICE}${NORMAL}" 132 ebegin ${GOOD}"Mouse is ${HILITE}${MOUSE_FULLNAME}${GOOD} at ${HILITE}${MOUSE_DEVICE}${NORMAL}"
114 source /etc/sysconfig/mouse 133 source /etc/sysconfig/mouse
115 if [ -x /usr/sbin/gpm ]; then 134 if [ -x /usr/sbin/gpm ]
135 then
116 if [ `grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm` ]; then 136 if [ $(grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm) ]
137 then
117 sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm 138 sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm
118 else 139 else
119 echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm 140 echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm
120 fi 141 fi
121 if [ `grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm` ]; then 142 if [ $(grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm) ]
143 then
122 sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm 144 sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm
123 else 145 else
124 echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm 146 echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm
125 fi 147 fi
126 if [ "$GPM" = "yes" ]; then 148 if [ "${GPM}" = "yes" ]
149 then
127 [ -x /etc/init.d/gpm ] && /etc/init.d/gpm start 150 [ -x /etc/init.d/gpm ] && /etc/init.d/gpm start
128 fi 151 fi
129 fi 152 fi
130 eend 153 eend
131 fi 154 fi
132 155
133 if [ "${HOTPLUG}" = "yes" ]; then 156 if [ "${HOTPLUG}" = "yes" ]
157 then
134 #Check whether we should be using hotplug or coldplug 158 #Check whether we should be using hotplug or coldplug
135 if [ -x /etc/init.d/coldplug ]; then 159 if [ -x /etc/init.d/coldplug ]
160 then
136 /etc/init.d/coldplug start 161 /etc/init.d/coldplug start
137 else 162 else
138 [ -x /etc/init.d/hotplug ] && /etc/init.d/hotplug start 163 [ -x /etc/init.d/hotplug ] && /etc/init.d/hotplug start
139 fi 164 fi
140 else 165 else
141 ebegin ${BAD}"Hotplug disabled via cmdline${NORMAL}" 166 ebegin ${BAD}"Hotplug disabled via cmdline${NORMAL}"
142 fi 167 fi
143 168
144 if [ "${DETECT}" = "no" ]; then 169 if [ "${DETECT}" = "no" ]
170 then
145 DHCP="no" 171 DHCP="no"
146 fi 172 fi
147 173
148 if [ "${DETECT}" = "yes" ]; then 174 if [ "${DETECT}" = "yes" ]
175 then
149 NETDEVICES="`awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null`" 176 NETDEVICES="$(awk -F: '/eth.:|tr.:|ath.:|wlan.:/{print $1}' /proc/net/dev 2>/dev/null)"
150 fi 177 fi
151 178
152 if [ -n "${NETDEVICES}" ]; then 179 if [ -n "${NETDEVICES}" ]
180 then
153 if [ "${DHCP}" = "yes" ]; then 181 if [ "${DHCP}" = "yes" ]
182 then
154 ebegin ${GOOD}"Network device${HILITE}${NETDEVICES}${GOOD} detected,${WARN} DHCP broadcasting for IP.${NORMAL}" 183 ebegin ${GOOD}"Network device${HILITE}${NETDEVICES}${GOOD} detected,${WARN} DHCP broadcasting for IP.${NORMAL}"
155 dhcpcd -h $(hostname) & 184 dhcpcd -h $(hostname) &
156 fi 185 fi
157 eend 186 eend
158 187
159 else 188 else
160 ebegin ${BAD}"No Network device auto detected.${NORMAL}" 189 ebegin ${BAD}"No Network device auto detected.${NORMAL}"
161 fi 190 fi
162 191
163 192
164 if [ -n "${SOUND_FULLNAME}" -o -n "${SOUND_DRIVER}" ]; then 193 if [ -n "${SOUND_FULLNAME}" -o -n "${SOUND_DRIVER}" ]
194 then
165 ebegin ${GOOD}"Soundcard:" 195 ebegin ${GOOD}"Soundcard:"
166 eend 196 eend
167 [ -n "${SOUND_FULLNAME}" ] 197 [ -n "${SOUND_FULLNAME}" ]
168 ebegin " ${WARN}${SOUND_FULLNAME}" 198 ebegin " ${WARN}${SOUND_FULLNAME}"
169 [ -n "${SOUND_DRIVER}" ] 199 [ -n "${SOUND_DRIVER}" ]
170 ebegin ${WARN}" driver = ${SOUND_DRIVER}"${HILITE} 200 ebegin ${WARN}" driver = ${SOUND_DRIVER}"${HILITE}
171 if [ -d /proc/asound/card0 ] && [ -x /usr/bin/amixer ]; then 201 if [ -d /proc/asound/card0 ] && [ -x /usr/bin/amixer ]
202 then
172 amixer scontrols > /etc/amixer 203 amixer scontrols > /etc/amixer
173 if [ -n "`grep Master /etc/amixer`" ] 204 if [ -n "$(grep Master /etc/amixer)" ]
174 then 205 then
175 amixer -q set Master 95% unmute >/dev/null 2>&1 206 amixer -q set Master 95% unmute >/dev/null 2>&1
176 fi 207 fi
177 if [ -n "`grep PCM /etc/amixer`" ] 208 if [ -n "$(grep PCM /etc/amixer)" ]
178 then 209 then
179 amixer -q set PCM 95% unmute >/dev/null 2>&1 210 amixer -q set PCM 95% unmute >/dev/null 2>&1
180 fi 211 fi
181 if [ -n "`grep Mic /etc/amixer`" ] 212 if [ -n "$(grep Mic /etc/amixer)" ]
182 then 213 then
183 amixer -q set Mic 95% unmute cap >/dev/null 2>&1 214 amixer -q set Mic 95% mute cap >/dev/null 2>&1
184 fi 215 fi
185 if [ -n "`grep Wave /etc/amixer`" ] 216 if [ -n "$(grep Wave /etc/amixer)" ]
186 then 217 then
187 amixer -q set Wave 95% unmute >/dev/null 2>&1 218 amixer -q set Wave 95% unmute >/dev/null 2>&1
188 fi 219 fi
189 if [ -n "`grep Capture /etc/amixer`" ] 220 if [ -n "$(grep Capture /etc/amixer)" ]
190 then 221 then
191 amixer -q set Capture 95% unmute cap >/dev/null 2>&1 222 amixer -q set Capture 95% unmute cap >/dev/null 2>&1
192 fi 223 fi
193 fi 224 fi
194 fi 225 fi
195 226
196 227
197 if [ -n "${XDESC}" -o -n "${XDESC}" ]; then 228 if [ -n "${XDESC}" -o -n "${XDESC}" ]
229 then
198 ebegin ${GOOD}"VideoCard: ${WARN} ${XDESC}" 230 ebegin ${GOOD}"VideoCard: ${WARN} ${XDESC}"
199 eend 231 eend
200 fi 232 fi
201 233
202 killall hwsetup 2>/dev/null 234 killall hwsetup 2>/dev/null

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

  ViewVC Help
Powered by ViewVC 1.1.20