/[livecd-tools]/trunk/autoconfig
Gentoo

Contents of /trunk/autoconfig

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (show annotations) (download)
Thu Oct 21 01:13:34 2004 UTC (10 years, 1 month ago) by wolf31o2
File size: 3997 byte(s)
Only run hwsetup when it exists.

1 #!/sbin/runscript
2 # Copyright 1999-2002 Gentoo Technologies, Inc.
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.5 2004/10/21 01:13:34 wolf31o2 Exp $
5
6 echo "0" > /proc/sys/kernel/printk
7 DHCP="yes"
8 DETECT="yes"
9 PCMCIA="no"
10 HOTPLUG="yes"
11 APM="no"
12 ACPI="no"
13 CMDLINE="`cat /proc/cmdline`"
14 for x in $CMDLINE ; do
15 if [ "$x" = "nodetect" ]; then
16 DETECT="no"
17 HOTPLUG="no"
18 APM="no"
19 ACPI="no"
20 fi
21
22 if [ "$x" = "nodhcp" ]; then
23 DHCP="no"
24 fi
25
26 if [ "$x" = "dopcmcia" ]; then
27 PCMCIA="yes"
28 fi
29
30 if [ "$x" = "doapm" ]; then
31 APM="yes"
32 ACPI="no"
33 fi
34
35 if [ "$x" = "acpi=on" ]; then
36 APM="no"
37 ACPI="yes"
38 fi
39
40 if [ "$x" = "nohotplug" ]; then
41 HOTPLUG="no"
42 fi
43 done
44
45 depend() {
46 need modules
47 }
48
49 start() {
50 if [ "$DETECT" = "yes" ]; then
51 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`
53 ebegin $GOOD"$PC"
54 eend
55 [ -x /usr/bin/hwsetup ] && hwsetup -p >/dev/null
56 eend
57 else
58 ebegin $WARN"Hardware detection disabled via cmdline$NORMAL"
59 fi
60
61 if [ "$APM" = "yes" ]; then
62 insmod apm power_off=1 >/dev/null 2>&1 && ebegin $GOOD"APM BIOS found, power management functions enabled.$NORMAL"
63 /etc/init.d/apmd start
64 else
65 ebegin $GOOD"Not Loading APM Bios support.${NORMAL}"
66 eend
67 fi
68
69 if [ "$ACPI" = "yes" ]; then
70 insmod processor >/dev/null 2>&1 && ebegin $GOOD ACPI power management functions enabled.$NORMAL
71 insmod fan >/dev/null
72 insmod thermal >/dev/null
73 insmod button >/dev/null
74 insmod battery >/dev/null
75 insmod ac >/dev/null
76 /etc/init.d/acpid start
77 eend
78 fi
79
80 if [ "$PCMCIA" = "yes" ]; then
81 ebegin $HILITE "PCMCIA enabled via cmdline"
82 /etc/init.d/pcmcia start
83 fi
84
85 if [ "$DHCP" = "no" ]; then
86 sed -i 's/iface_eth0="dhcp"/#iface_eth0="dhcp"/' /etc/conf.d/net
87 ebegin $BAD"Skipping DHCP broadcast detection as requested on boot commandline."
88 fi
89
90 #Read in what hwsetup has found
91 [ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix
92
93 # Mouse
94 if [ -n "$MOUSE_DEVICE" ]; then
95 ebegin $GOOD"Mouse is $HILITE$MOUSE_FULLNAME$GOOD at $HILITE$MOUSE_DEVICE$NORMAL"
96 source /etc/sysconfig/mouse
97 [ -x /usr/sbin/gpm ] && gpm -m "${MOUSE_DEVICE}" -t "${MOUSETYPE}"
98 eend
99 fi
100
101 if [ "$HOTPLUG" = "yes" ]; then
102 /etc/init.d/hotplug start
103 else
104 ebegin $BAD"Hotplug disabled via cmdline$NORMAL"
105 fi
106
107 if [ "$DETECT" = "no" ]; then
108 DHCP="no"
109 fi
110
111 if [ "$DETECT" = "yes" ]; then
112 NETDEVICES="`awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null`"
113 fi
114
115 if [ -n "$NETDEVICES" ]; then
116 if [ "${DHCP}" = "yes" ]; then
117 ebegin $GOOD"Network device$HILITE$NETDEVICES$GOOD detected,$WARN DHCP broadcasting for IP.$NORMAL"
118 dhcpcd &
119 fi
120 eend
121
122 else
123 ebegin $BAD"No Network device auto detected.$NORMAL"
124 fi
125
126
127 if [ -n "$SOUND_FULLNAME" -o -n "$SOUND_DRIVER" ]; then
128 ebegin $GOOD"Soundcard:"
129 eend
130 if [ -d /proc/asound/card0 ] && [ -x /usr/bin/amixer ]; then
131 amixer scontrols > /etc/amixer
132 [ -n "`grep Master /etc/amixer`" ] && amixer set Master 75% \
133 && amixer set Master unmute
134 [ -n "`grep PCM /etc/amixer`" ] && amixer set PCM 75% \
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
143 [ -n "$SOUND_FULLNAME" ]
144 ebegin " $WARN$SOUND_FULLNAME"
145 [ -n "$SOUND_DRIVER" ]
146 ebegin $WARN" driver = $SOUND_DRIVER"$HILITE
147 fi
148
149
150 if [ -n "$XDESC" -o -n "$XDESC" ]; then
151 ebegin $GOOD"VideoCard: $WARN ${XDESC}"
152 eend
153 fi
154
155 killall hwsetup 2>/dev/null
156 echo "6" > /proc/sys/kernel/printk
157
158 }
159
160 # vim: ts=4

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.20