/[livecd-tools]/trunk/autoconfig
Gentoo

Diff of /trunk/autoconfig

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

Revision 50 Revision 51
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.26 2005/05/16 18:21:48 wolf31o2 Exp $ 4# $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.27 2005/05/16 19:26:39 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() {
59 before net 69 before net
60# provide gpm pcmcia apmd acpid coldplug hdparm 70# provide gpm pcmcia apmd acpid coldplug hdparm
61} 71}
62 72
63start() { 73start() {
64 if [ "${DETECT}" = "yes" ]; then 74 if [ "${DETECT}" = "yes" ]
75 then
65 ebegin ${WARN}"Hardware detection started" 76 ebegin ${WARN}"Hardware detection started"
66 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)
67 ebegin ${GOOD}"${PC}" 78 ebegin ${GOOD}"${PC}"
68 eend 79 eend
69 [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null 80 [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null
70 eend 81 eend
71 else 82 else
72 ebegin ${WARN}"Hardware detection disabled via cmdline$NORMAL" 83 ebegin ${WARN}"Hardware detection disabled via cmdline$NORMAL"
73 fi 84 fi
74 85
75 if [ "${APM}" = "yes" ]; then 86 if [ "${APM}" = "yes" ]
87 then
76 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}"
77 [ -x /etc/init.d/apmd ] && /etc/init.d/apmd start 89 [ -x /etc/init.d/apmd ] && /etc/init.d/apmd start
78 else 90 else
79 ebegin ${GOOD}"Not Loading APM Bios support.${NORMAL}" 91 ebegin ${GOOD}"Not Loading APM Bios support.${NORMAL}"
80 eend 92 eend
81 fi 93 fi
82 94
83 if [ "${ACPI}" = "yes" ]; then 95 if [ "${ACPI}" = "yes" ]
96 then
84 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
85 modprobe fan >/dev/null 2>&1 98 modprobe fan >/dev/null 2>&1
86 modprobe button >/dev/null 2>&1 99 modprobe button >/dev/null 2>&1
87 modprobe battery >/dev/null 2>&1 100 modprobe battery >/dev/null 2>&1
88 modprobe ac >/dev/null 2>&1 101 modprobe ac >/dev/null 2>&1
89 [ -x /etc/init.d/acpid ] && /etc/init.d/acpid start 102 [ -x /etc/init.d/acpid ] && /etc/init.d/acpid start
90 eend 103 eend
91 fi 104 fi
92 105
93 if [ "${IDEDMA}" = "yes" ]; then 106 if [ "${IDEDMA}" = "yes" ]
107 then
94 [ -x /etc/init.d/hdparm ] && /etc/init.d/hdparm start 108 [ -x /etc/init.d/hdparm ] && /etc/init.d/hdparm start
95 fi 109 fi
96 110
97 if [ "${PCMCIA}" = "yes" ]; then 111 if [ "${PCMCIA}" = "yes" ]
112 then
98 ebegin ${HILITE} "PCMCIA enabled via cmdline" 113 ebegin ${HILITE} "PCMCIA enabled via cmdline"
99 /etc/init.d/pcmcia start 114 /etc/init.d/pcmcia start
100 fi 115 fi
101 116
102 if [ "${DHCP}" = "no" ]; then 117 if [ "${DHCP}" = "no" ]
118 then
103 sed -i -e '/^ifconfig_eth.*dhcp.*/ s/^/#/' \ 119 sed -i -e '/^ifconfig_eth.*dhcp.*/ s/^/#/' \
104 -e '/^iface_eth.*dhcp.*/ s/^/#/' \ 120 -e '/^iface_eth.*dhcp.*/ s/^/#/' \
105 /etc/conf.d/net 121 /etc/conf.d/net
106 ebegin ${BAD}"Skipping DHCP broadcast detection as requested on boot commandline." 122 ebegin ${BAD}"Skipping DHCP broadcast detection as requested on boot commandline."
107 fi 123 fi
108 124
109 #Read in what hwsetup has found 125 #Read in what hwsetup has found
110 [ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix 126 [ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix
111 127
112 # Mouse 128 # Mouse
113 if [ -n "${MOUSE_DEVICE}" ]; then 129 if [ -n "${MOUSE_DEVICE}" ]
130 then
114 ebegin ${GOOD}"Mouse is ${HILITE}${MOUSE_FULLNAME}${GOOD} at ${HILITE}${MOUSE_DEVICE}${NORMAL}" 131 ebegin ${GOOD}"Mouse is ${HILITE}${MOUSE_FULLNAME}${GOOD} at ${HILITE}${MOUSE_DEVICE}${NORMAL}"
115 source /etc/sysconfig/mouse 132 source /etc/sysconfig/mouse
116 if [ -x /usr/sbin/gpm ]; then 133 if [ -x /usr/sbin/gpm ]
134 then
117 if [ `grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm` ]; then 135 if [ $(grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm) ]
136 then
118 sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm 137 sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm
119 else 138 else
120 echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm 139 echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm
121 fi 140 fi
122 if [ `grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm` ]; then 141 if [ $(grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm) ]
142 then
123 sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm 143 sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm
124 else 144 else
125 echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm 145 echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm
126 fi 146 fi
127 if [ "$GPM" = "yes" ]; then 147 if [ "${GPM}" = "yes" ]
148 then
128 [ -x /etc/init.d/gpm ] && /etc/init.d/gpm start 149 [ -x /etc/init.d/gpm ] && /etc/init.d/gpm start
129 fi 150 fi
130 fi 151 fi
131 eend 152 eend
132 fi 153 fi
133 154
134 if [ "${HOTPLUG}" = "yes" ]; then 155 if [ "${HOTPLUG}" = "yes" ]
156 then
135 #Check whether we should be using hotplug or coldplug 157 #Check whether we should be using hotplug or coldplug
136 if [ -x /etc/init.d/coldplug ]; then 158 if [ -x /etc/init.d/coldplug ]
159 then
137 /etc/init.d/coldplug start 160 /etc/init.d/coldplug start
138 else 161 else
139 [ -x /etc/init.d/hotplug ] && /etc/init.d/hotplug start 162 [ -x /etc/init.d/hotplug ] && /etc/init.d/hotplug start
140 fi 163 fi
141 else 164 else
142 ebegin ${BAD}"Hotplug disabled via cmdline${NORMAL}" 165 ebegin ${BAD}"Hotplug disabled via cmdline${NORMAL}"
143 fi 166 fi
144 167
145 if [ "${DETECT}" = "no" ]; then 168 if [ "${DETECT}" = "no" ]
169 then
146 DHCP="no" 170 DHCP="no"
147 fi 171 fi
148 172
149 if [ "${DETECT}" = "yes" ]; then 173 if [ "${DETECT}" = "yes" ]
174 then
150 NETDEVICES="`awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null`" 175 NETDEVICES="$(awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null)"
151 fi 176 fi
152 177
153 if [ -n "${NETDEVICES}" ]; then 178 if [ -n "${NETDEVICES}" ]
179 then
154 if [ "${DHCP}" = "yes" ]; then 180 if [ "${DHCP}" = "yes" ]
181 then
155 ebegin ${GOOD}"Network device${HILITE}${NETDEVICES}${GOOD} detected,${WARN} DHCP broadcasting for IP.${NORMAL}" 182 ebegin ${GOOD}"Network device${HILITE}${NETDEVICES}${GOOD} detected,${WARN} DHCP broadcasting for IP.${NORMAL}"
156 dhcpcd -h $(hostname) & 183 dhcpcd -h $(hostname) &
157 fi 184 fi
158 eend 185 eend
159 186
160 else 187 else
161 ebegin ${BAD}"No Network device auto detected.${NORMAL}" 188 ebegin ${BAD}"No Network device auto detected.${NORMAL}"
162 fi 189 fi
163 190
164 191
165 if [ -n "${SOUND_FULLNAME}" -o -n "${SOUND_DRIVER}" ]; then 192 if [ -n "${SOUND_FULLNAME}" -o -n "${SOUND_DRIVER}" ]
193 then
166 ebegin ${GOOD}"Soundcard:" 194 ebegin ${GOOD}"Soundcard:"
167 eend 195 eend
168 [ -n "${SOUND_FULLNAME}" ] 196 [ -n "${SOUND_FULLNAME}" ]
169 ebegin " ${WARN}${SOUND_FULLNAME}" 197 ebegin " ${WARN}${SOUND_FULLNAME}"
170 [ -n "${SOUND_DRIVER}" ] 198 [ -n "${SOUND_DRIVER}" ]
171 ebegin ${WARN}" driver = ${SOUND_DRIVER}"${HILITE} 199 ebegin ${WARN}" driver = ${SOUND_DRIVER}"${HILITE}
172 if [ -d /proc/asound/card0 ] && [ -x /usr/bin/amixer ]; then 200 if [ -d /proc/asound/card0 ] && [ -x /usr/bin/amixer ]
201 then
173 amixer scontrols > /etc/amixer 202 amixer scontrols > /etc/amixer
174 if [ -n "`grep Master /etc/amixer`" ] 203 if [ -n "`grep Master /etc/amixer`" ]
175 then 204 then
176 amixer -q set Master 95% unmute >/dev/null 2>&1 205 amixer -q set Master 95% unmute >/dev/null 2>&1
177 fi 206 fi
193 fi 222 fi
194 fi 223 fi
195 fi 224 fi
196 225
197 226
198 if [ -n "${XDESC}" -o -n "${XDESC}" ]; then 227 if [ -n "${XDESC}" -o -n "${XDESC}" ]
228 then
199 ebegin ${GOOD}"VideoCard: ${WARN} ${XDESC}" 229 ebegin ${GOOD}"VideoCard: ${WARN} ${XDESC}"
200 eend 230 eend
201 fi 231 fi
202 232
203 killall hwsetup 2>/dev/null 233 killall hwsetup 2>/dev/null

Legend:
Removed from v.50  
changed lines
  Added in v.51

  ViewVC Help
Powered by ViewVC 1.1.20