Bug#224641: Better patch!
The serial config needs to go near the top of the file so appending it did
not work!
This patch puts the serial config at the top of the file!
Alex Owen
NB: this is still untested as far as a d-i install is concerned.
--- postinst.orig 2004-11-02 14:59:09.000000000 +0000
+++ postinst 2004-11-25 21:35:48.000000000 +0000
@@ -33,6 +33,25 @@
fi
}
+grub_serial_console() {
+ #$1=output of get_serial_console
+ local unit=$(echo $1 | sed -e 's%^console=ttyS%%' -e 's%,.*%%')
+ local speed=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,%%' -e 's%[^(0-9)].*%%')
+ local parity=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,[0-9]\+%%' -e 's%[78].*%%')
+ case "$parity" in
+ "n") local parity="no" ;;
+ "e") local parity="even" ;;
+ "o") local parity="odd" ;;
+ *) local parity="" ;;
+ esac
+ local word=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,[0-9]\+[oen]%%' -e 's%r%%')
+ local flow=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,[0-9]\+[oen][78]%%')
+
+ echo serial --unit=$unit --speed=$speed --word=$word --parity=$parity --stop=1
+ echo terminal serial
+ }
+
+
serial="$(get_serial_console)"
# This is copied from update-grub. We've requested that it be moved
@@ -390,6 +409,13 @@
update_grub # again, to add new options to all the Debian kernel entries
fi
+if [ -n "$serial" ] ; then
+ # Modify menu.lst so _grub_ uses serial console.
+ grub_serial_console $serial | cat - /target/boot/grub/menu.lst > /target/boot/grub/menu.lst.new
+ mv /target/boot/grub/menu.lst.new /target/boot/grub/menu.lst
+fi
+
+
# Generation menu.lst addition for other OSes.
tmpfile=/tmp/menu.lst.extras
OLDIFS="$IFS"
Reply to: