--- autoconfig.orig 2005-09-25 23:54:38 -0400 +++ autoconfig 2005-09-26 15:51:10 -0400 @@ -18,63 +18,36 @@ get_config() { CMDLINE="$(cat /proc/cmdline)" for x in ${CMDLINE} ; do - if [ "${x}" = "nodetect" ] - then - DETECT="no" - GPM="no" - HOTPLUG="no" - APM="no" - ACPI="no" - ALSA="no" - X11="no" - fi - - if [ "${x}" = "nodhcp" ] - then - DHCP="no" - fi - - if [ "${x}" = "nogpm" ] - then - GPM="no" - fi - - if [ "${x}" = "dopcmcia" ] - then - PCMCIA="yes" - fi - - if [ "${x}" = "doapm" ] - then - APM="yes" - ACPI="no" - fi - - if [ "${x}" = "acpi=on" -o "${x}" = "acpi=force" ] - then - APM="no" - ACPI="yes" - fi - - if [ "${x}" = "ide=nodma" ] - then - IDEDMA="no" - fi - - if [ "${x}" = "nohotplug" ] - then - HOTPLUG="no" - fi - - if [ "${x}" = "nosound" ] - then - ALSA="no" - fi - - if [ "${x}" = "nox" ] - then - X11="no" - fi + case "${x}" in + nodetect) + DETECT="no" + GPM="no" + HOTPLUG="no" + APM="no" + ACPI="no" + ALSA="no" + X11="no" + ;; + + nodhcp) DHCP="no" ;; + nogpm) GPM="no" ;; + dopcmcia) PCMCIA="yes" ;; + + doapm) + APM="yes" + ACPI="no" + ;; + + acpi=on|acpi=force) + APM="no" + ACPI="yes" + ;; + + ide=nodma) IDEDMA="no" ;; + nohotplug) HOTPLUG="no" ;; + nosound) ALSA="no" ;; + nox) X11="no" ;; + esac done } @@ -114,195 +87,145 @@ list_services() { start() { echo "0" > /proc/sys/kernel/printk get_config - if [ "${DETECT}" = "yes" ] - then - ebegin ${WARN}"Hardware detection started" - 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) - ebegin ${GOOD}"${PC}" - eend - [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null + if [ "${DETECT}" = "yes" ]; then + ebegin "Hardware detection started" + 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) + einfo "${PC}" + [ -x /usr/sbin/hwsetup ] && hwsetup -p >/dev/null eend else - ebegin ${WARN}"Hardware detection disabled via cmdline$NORMAL" + ewarn "Hardware detection disabled via cmdline ..." fi - if [ "${APM}" = "yes" ] - then - modprobe apm power_off=1 >/dev/null 2>&1 && ebegin ${GOOD}"APM BIOS found, power management functions enabled.${NORMAL}" + if [ "${APM}" = "yes" ]; then + modprobe apm power_off=1 >/dev/null 2>&1 && einfo "APM BIOS found, power management functions enabled ..." [ -x /etc/init.d/apmd ] && start_service apmd else - ebegin ${GOOD}"Not Loading APM Bios support.${NORMAL}" - eend + ewarn "Not Loading APM Bios support ..." fi - if [ "${ACPI}" = "yes" ] - then - modprobe processor >/dev/null 2>&1 && ebegin ${GOOD} ACPI power management functions enabled.${NORMAL} && modprobe thermal >/dev/null + if [ "${ACPI}" = "yes" ]; then + modprobe processor >/dev/null 2>&1 && ebegin "ACPI power management functions enabled" && modprobe thermal >/dev/null modprobe fan >/dev/null 2>&1 modprobe button >/dev/null 2>&1 modprobe battery >/dev/null 2>&1 modprobe ac >/dev/null 2>&1 [ -x /etc/init.d/acpid ] && start_service acpid eend + else + ewarn "Not Loading ACPI support ..." fi - if [ "${IDEDMA}" = "yes" ] - then + if [ "${IDEDMA}" = "yes" ]; then [ -x /etc/init.d/hdparm ] && start_service hdparm fi - if [ "${PCMCIA}" = "yes" ] - then - ebegin ${HILITE} "PCMCIA enabled via cmdline" + if [ "${PCMCIA}" = "yes" ]; then + einfo "PCMCIA enabled via cmdline ..." [ -x /etc/init.d/pcmcia ] && start_service pcmcia fi - if [ "${DHCP}" = "no" ] - then + if [ "${DHCP}" = "no" ]; then sed -i -e '/^ifconfig_eth.*dhcp.*/ s/^/#/' \ -e '/^iface_eth.*dhcp.*/ s/^/#/' \ -e '/^config_eth.*dhcp.*/ s/^/#/' \ /etc/conf.d/net - ebegin ${BAD}"Skipping DHCP broadcast detection as requested on boot commandline." + ewarn "Skipping DHCP broadcast detection as requested on boot commandline ..." fi - #Read in what hwsetup has found + # Read in what hwsetup has found [ -f /etc/sysconfig/knoppix ] && . /etc/sysconfig/knoppix [ -f /etc/sysconfig/gentoo ] && . /etc/sysconfig/gentoo # Mouse - if [ -n "${MOUSE_DEVICE}" ] - then - ebegin ${GOOD}"Mouse is ${HILITE}${MOUSE_FULLNAME}${GOOD} at ${HILITE}${MOUSE_DEVICE}${NORMAL}" + if [ -n "${MOUSE_DEVICE}" ]; then + einfo "Mouse is ${HILITE}${MOUSE_FULLNAME}${NORMAL} at ${HILITE}${MOUSE_DEVICE}${NORMAL} ..." source /etc/sysconfig/mouse - if [ -x /usr/sbin/gpm ] - then - if [ $(grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm) ] - then - sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm - else - echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm - fi - if [ $(grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm) ] - then - sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm - else - echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm - fi - if [ "${GPM}" = "yes" ] - then - [ -x /etc/init.d/gpm ] && start_service gpm - fi + if [ -x /usr/sbin/gpm ]; then + [ $(grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm) ] \ + && sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm \ + || echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm + + [ $(grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm) ] \ + && sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm \ + || echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm + + [ "${GPM}" = "yes" ] \ + && [ -x /etc/init.d/gpm ] && start_service gpm fi - eend fi - if [ "${HOTPLUG}" = "yes" ] - then - #Check whether we should be using hotplug or coldplug - if [ -x /etc/init.d/coldplug ] - then + if [ "${HOTPLUG}" = "yes" ]; then + # Check whether we should be using hotplug or coldplug + if [ -x /etc/init.d/coldplug ]; then start_service coldplug - elif [ -x /etc/init.d/hotplug ] - then + elif [ -x /etc/init.d/hotplug ]; then start_service hotplug fi else - ebegin ${BAD}"Hotplug disabled via cmdline${NORMAL}" + ewarn "Hotplug disabled via cmdline ..." fi - if [ "${DETECT}" = "no" ] - then - DHCP="no" - fi - - if [ "${DETECT}" = "yes" ] - then - NETDEVICES="$(awk -F: '/eth.:|tr.:|ath.:|wlan.:/{print $1}' /proc/net/dev 2>/dev/null)" - fi + [ "${DETECT}" = "no" ] && DHCP="no" + [ "${DETECT}" = "yes" ] \ + && NETDEVICES="$(awk -F: '/eth.:|tr.:|ath.:|wlan.:/{print $1}' /proc/net/dev 2>/dev/null)" - if [ -n "${NETDEVICES}" ] - then - for nics in ${NETDEVICES} - do - if [ "${DHCP}" = "yes" ] - then - ebegin ${GOOD}"Network device${HILITE}${nics}${GOOD} detected,${WARN} DHCP broadcasting for IP.${NORMAL}" + if [ -n "${NETDEVICES}" ]; then + for nics in ${NETDEVICES}; do + if [ "${DHCP}" = "yes" ]; then + einfo "Network device ${HILITE}${nics}${NORMAL} detected, DHCP broadcasting for IP ..." dhcpcd -n -h $(hostname) & fi - eend done else - ebegin ${BAD}"No Network device auto detected.${NORMAL}" + ewarn "No Network device auto detected ..." fi - if [ "${ALSA}" = "yes" ] - then - if [ -n "${SOUND_FULLNAME}" -o -n "${SOUND_DRIVER}" ] - then - ebegin ${GOOD}"Soundcard:" - eend - [ -n "${SOUND_FULLNAME}" ] - ebegin " ${WARN}${SOUND_FULLNAME}" - [ -n "${SOUND_DRIVER}" ] - ebegin ${WARN}" driver = ${SOUND_DRIVER}"${HILITE} - if [ -x /etc/init.d/alsasound ] - then + if [ "${ALSA}" = "yes" ]; then + if [ -n "${SOUND_FULLNAME}" -o -n "${SOUND_DRIVER}" ]; then + local sndmsg="Soundcard:\n" + + [ -n "${SOUND_FULLNAME}" ] \ + && sndmsg="${sndmsg} ${WARN}${SOUND_FULLNAME}\n" + [ -n "${SOUND_DRIVER}" ] \ + && sndmsg="${sndmsg} driver = ${SOUND_DRIVER}\n" + + einfo "${sndmsg}" + + + if [ -x /etc/init.d/alsasound ]; then start_service alsasound else - ebegin ${WARN}"/etc/init.d/alsasound not found, skipping." - einfo "You will need to set volume controls manually." + ewarn "/etc/init.d/alsasound not found, skipping ..." + ewarn "You will need to set volume controls manually ..." fi - for i in $(cat /proc/asound/cards | cut -d" " -f1) - do - if [ -d /proc/asound/card$i ] && [ -x /usr/bin/amixer ] - then + + for i in $(cat /proc/asound/cards | cut -d" " -f1); do + if [ -d /proc/asound/card$i ] && [ -x /usr/bin/amixer ]; then amixer -c $i scontrols > /etc/amixer - if [ -n "$(grep Master /etc/amixer)" ] - then - amixer -c $i -q set Master 95% unmute >/dev/null 2>&1 - fi - if [ -n "$(grep PCM /etc/amixer)" ] - then - amixer -c $i -q set PCM 95% unmute >/dev/null 2>&1 - fi - if [ -n "$(grep Mic /etc/amixer)" ] - then - amixer -c $i -q set Mic 95% mute cap >/dev/null 2>&1 - fi - if [ -n "$(grep Wave /etc/amixer)" ] - then - amixer -c $i -q set Wave 95% unmute >/dev/null 2>&1 - fi - if [ -n "$(grep Capture /etc/amixer)" ] - then - amixer -c $i -q set Capture 95% unmute cap >/dev/null 2>&1 - fi + [ -n "$(grep Master /etc/amixer)" ] \ + && amixer -c $i -q set Master 95% unmute >/dev/null 2>&1 + [ -n "$(grep PCM /etc/amixer)" ] \ + && amixer -c $i -q set PCM 95% unmute >/dev/null 2>&1 + [ -n "$(grep Mic /etc/amixer)" ] \ + && amixer -c $i -q set Mic 95% mute cap >/dev/null 2>&1 + [ -n "$(grep Wave /etc/amixer)" ] \ + && amixer -c $i -q set Wave 95% unmute >/dev/null 2>&1 + [ -n "$(grep Capture /etc/amixer)" ] \ + && amixer -c $i -q set Capture 95% unmute cap >/dev/null 2>&1 fi done fi else - ebegin ${BAD}"Skipping ALSA detection as requested on boot commandline." + ewarn "Skipping ALSA detection as requested on boot commandline ..." fi - if [ "${DETECT}" = "yes" ] - then - if [ -x /etc/init.d/x-setup ] - then - schedule_service_startup x-setup - fi - fi - - if [ "${X11}" = "no" ] - then - touch /etc/init.d/.noxdm + if [ "${DETECT}" = "yes" ]; then + [ -x /etc/init.d/x-setup ] && schedule_service_startup x-setup fi - if [ -n "${XDESC}" ] - then - ebegin ${GOOD}"VideoCard: ${WARN} ${XDESC}" - eend - fi + [ "${X11}" = "no" ] && touch /etc/init.d/.noxdm + [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}" killall hwsetup 2>/dev/null echo "6" > /proc/sys/kernel/printk