/[livecd-tools]/trunk/autoconfig
Gentoo

Diff of /trunk/autoconfig

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

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

Legend:
Removed from v.17  
changed lines
  Added in v.18

  ViewVC Help
Powered by ViewVC 1.1.20