This bug lies in the grub-installer script in the function grub_serial_console. Attached is the file grub_serial_console.txt is a replacement grub_serial_console function which parses the kernel command line "console=" argument in a more robust and (I hope) readable manner. A test script test.sh is also attached which can be used to excercise the grub_serial_console function in the file grub_serial_console.txt. I know this is very late in the release cycle but I would like to see this rewrite of grub_serial_console enter d-i for Etch. Regards Alex Owen [For Lenny: While rewriting grub_serial_console I thought I would tidy up the function get_serial_console. Attached is the file get_serial_console.txt which contains a drop-in replacement for the function get_serial_console. This should _not_ be targeted at Etch]
grub_serial_console() {
#$1=output of get_serial_console
local serconsole=${1##console=}
local device=${serconsole%%,*}
local unit=${device##ttyS}
local options=${serconsole##*,}
#Handle case when no options given
[ "$options" == "$device" ] && local options=""
local speed=$(echo $options | sed -e's%^\([0-9]\+\).*%\1%')
local parity_word_flow=${options##${speed}}
local word_flow=${parity_word_flow#?}
local parity=${parity_word_flow%%${word_flow}}
local flow=${word_flow#?}
local word=${word_flow%%${flow}}
case "$parity" in
"n") local parity="--parity=no" ;;
"e") local parity="--parity=even" ;;
"o") local parity="--parity=odd" ;;
*) local parity="" ;;
esac
[ $word ] && local word="--word=$word"
[ $speed ] || local speed=9600 #Match Kernel Default
echo serial --unit=$unit --speed=$speed $word $parity --stop=1
echo terminal serial
}
Attachment:
test.sh
Description: Bourne shell script
#For Lenny
get_serial_console() {
for x in $(cat /proc/cmdline); do
case $x in
console=*)
local defconsole="${x#*=}" ;;
esac
done
if echo "${defconsole}" | grep -q ttyS; then
echo "console=$defconsole"
fi
}