diff options
author | Chris Gianelloni <wolf31o2@gentoo.org> | 2005-10-12 17:15:27 +0000 |
---|---|---|
committer | Chris Gianelloni <wolf31o2@gentoo.org> | 2005-10-12 17:15:27 +0000 |
commit | c905780a83690d55a5030e0040d9f5c6bac76630 (patch) | |
tree | 71a436b40492f3dcbb3a96ee7c7d33e46143e784 /src/livecd-tools | |
parent | sync to 1.116 (diff) | |
download | gentoo-c905780a83690d55a5030e0040d9f5c6bac76630.tar.gz gentoo-c905780a83690d55a5030e0040d9f5c6bac76630.tar.bz2 gentoo-c905780a83690d55a5030e0040d9f5c6bac76630.zip |
Added patch from Joshua Kinard <kumba@gentoo.org> for bug #106988.
Diffstat (limited to 'src/livecd-tools')
-rw-r--r-- | src/livecd-tools/autoconfig | 262 |
1 files changed, 113 insertions, 149 deletions
diff --git a/src/livecd-tools/autoconfig b/src/livecd-tools/autoconfig index ee54b1a61e..576ae63f2d 100644 --- a/src/livecd-tools/autoconfig +++ b/src/livecd-tools/autoconfig @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.42 2005/08/30 17:52:45 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/livecd-tools/autoconfig,v 1.43 2005/10/12 17:15:27 wolf31o2 Exp $ DHCP="yes" DETECT="yes" @@ -18,63 +18,46 @@ 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 } @@ -87,10 +70,13 @@ depend() { # Checks whether a service will be started by autoconfig. # Usage: check_svc var service [service_alternative] check_svc() { - if [ "$1" = "yes" ]; then - if [ -x "/etc/init.d/$2" ]; then + if [ "$1" = "yes" ] + then + if [ -x "/etc/init.d/$2" ] + then echo "$2" - elif [ -n "$3" -a -x "/etc/init.d/$3" ]; then + elif [ -n "$3" -a -x "/etc/init.d/$3" ] + then echo "$3" fi fi @@ -116,34 +102,37 @@ start() { 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 + 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}" + 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 + 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" ] @@ -153,7 +142,7 @@ start() { if [ "${PCMCIA}" = "yes" ] then - ebegin ${HILITE} "PCMCIA enabled via cmdline" + einfo "PCMCIA enabled via cmdline ..." [ -x /etc/init.d/pcmcia ] && start_service pcmcia fi @@ -163,43 +152,36 @@ start() { -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}" + 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 + [ $(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 + # Check whether we should be using hotplug or coldplug if [ -x /etc/init.d/coldplug ] then start_service coldplug @@ -208,18 +190,12 @@ start() { 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 @@ -227,82 +203,70 @@ start() { do if [ "${DHCP}" = "yes" ] then - ebegin ${GOOD}"Network device${HILITE}${nics}${GOOD} detected,${WARN} DHCP broadcasting for IP.${NORMAL}" + 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} + 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 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 + [ -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 |