/[livecd-tools]/trunk/autoconfig
Gentoo

Diff of /trunk/autoconfig

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

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

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

  ViewVC Help
Powered by ViewVC 1.1.20