| 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.12 2004/12/14 23:51:28 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/sbin/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} && insmod thermal >/dev/null
|
| 71 |
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 |
/etc/init.d/acpid start
|
| 76 |
eend
|
| 77 |
fi
|
| 78 |
|
| 79 |
if [ "${PCMCIA}" = "yes" ]; then
|
| 80 |
ebegin ${HILITE} "PCMCIA enabled via cmdline"
|
| 81 |
/etc/init.d/pcmcia start
|
| 82 |
fi
|
| 83 |
|
| 84 |
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 |
fi
|
| 92 |
|
| 93 |
#Read in what hwsetup has found
|
| 94 |
[ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix
|
| 95 |
|
| 96 |
# Mouse
|
| 97 |
if [ -n "${MOUSE_DEVICE}" ]; then
|
| 98 |
ebegin ${GOOD}"Mouse is ${HILITE}${MOUSE_FULLNAME}${GOOD} at ${HILITE}${MOUSE_DEVICE}${NORMAL}"
|
| 99 |
source /etc/sysconfig/mouse
|
| 100 |
[ -x /usr/sbin/gpm ] && gpm -m "${MOUSE_DEVICE}" -t "${MOUSETYPE}"
|
| 101 |
eend
|
| 102 |
fi
|
| 103 |
|
| 104 |
if [ "${HOTPLUG}" = "yes" ]; then
|
| 105 |
#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 |
else
|
| 112 |
ebegin ${BAD}"Hotplug disabled via cmdline${NORMAL}"
|
| 113 |
fi
|
| 114 |
|
| 115 |
if [ "${DETECT}" = "no" ]; then
|
| 116 |
DHCP="no"
|
| 117 |
fi
|
| 118 |
|
| 119 |
if [ "${DETECT}" = "yes" ]; then
|
| 120 |
NETDEVICES="`awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null`"
|
| 121 |
fi
|
| 122 |
|
| 123 |
if [ -n "${NETDEVICES}" ]; then
|
| 124 |
if [ "${DHCP}" = "yes" ]; then
|
| 125 |
ebegin ${GOOD}"Network device${HILITE}${NETDEVICES}${GOOD} detected,${WARN} DHCP broadcasting for IP.${NORMAL}"
|
| 126 |
dhcpcd -h `basename hostname` &
|
| 127 |
fi
|
| 128 |
eend
|
| 129 |
|
| 130 |
else
|
| 131 |
ebegin ${BAD}"No Network device auto detected.${NORMAL}"
|
| 132 |
fi
|
| 133 |
|
| 134 |
|
| 135 |
if [ -n "${SOUND_FULLNAME}" -o -n "${SOUND_DRIVER}" ]; then
|
| 136 |
ebegin ${GOOD}"Soundcard:"
|
| 137 |
eend
|
| 138 |
[ -n "${SOUND_FULLNAME}" ]
|
| 139 |
ebegin " ${WARN}${SOUND_FULLNAME}"
|
| 140 |
[ -n "${SOUND_DRIVER}" ]
|
| 141 |
ebegin ${WARN}" driver = ${SOUND_DRIVER}"${HILITE}
|
| 142 |
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 |
fi
|
| 156 |
|
| 157 |
|
| 158 |
if [ -n "${XDESC}" -o -n "${XDESC}" ]; then
|
| 159 |
ebegin ${GOOD}"VideoCard: ${WARN} ${XDESC}"
|
| 160 |
eend
|
| 161 |
fi
|
| 162 |
|
| 163 |
killall hwsetup 2>/dev/null
|
| 164 |
echo "6" > /proc/sys/kernel/printk
|
| 165 |
|
| 166 |
}
|
| 167 |
|
| 168 |
# vim: ts=4
|