/[livecd-tools]/trunk/autoconfig
Gentoo

Contents of /trunk/autoconfig

Parent Directory Parent Directory | Revision Log Revision Log


Revision 20 - (hide annotations) (download)
Thu Nov 25 04:42:53 2004 UTC (13 years, 9 months ago) by wolf31o2
File size: 4542 byte(s)
I need to learn awk, really...

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.20