X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=f55b0d37215f8efd0973223eb6dc9213e2eaa16e;hp=c0c1111b4f9c23ffbbb631421af3e94a08f065a9;hb=229c1272d15be52423ec2f6914d5664313501cac;hpb=975698c289322e14b730adaae36a907b30fc251e diff --git a/autoconfig.functions b/autoconfig.functions index c0c1111..f55b0d3 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -575,8 +575,33 @@ fi # activate serial console {{{ config_console(){ if checkbootparam 'console'; then - einfo "Bootoption for serial console detected, activating console login." - sed -i 's/^#grmlserial#//' /etc/inittab + einfo "Bootoption for serial console detected:" + + local serial="$(getbootparam console=ttyS)" + option="${serial##*,}" + + # default to: + local speed="115200,57600,38400,19200,9600,4800,2400,1200"; + # ... unless overriden by command line: + case "$option" in + 115200*) speed=115200 ;; + 57600*) speed=57600 ;; + 38400*) speed=38400 ;; + 19200*) speed=19200 ;; + 9600*) speed=9600 ;; + 4800*) speed=4800 ;; + 2400*) speed=2400 ;; + 1200*) speed=1200 ;; + esac + + eindent + einfo "Setting baud rate to ${speed}." + sed -i "s/%serialspeed%/$speed/" /etc/inittab ; eend $? + + einfo "Activating console login." + sed -i 's/^#grmlserial#//' /etc/inittab ; eend $? + eoutdent + /sbin/telinit q eend $? fi