--- recepies/amt/serial-console.sh 2009/05/17 11:58:25 77 +++ recepies/amt/serial-console.sh 2009/05/19 17:56:59 89 @@ -4,6 +4,8 @@ ttyS=`dmesg | grep ttyS | grep 0xe | sed 's/^.*\(ttyS[0-9]\).*$/\1/'` +test -z "$ttyS" && echo "Can't find serial port in dmesg output" && exit + if ! grep ttyS1 /etc/inittab | grep -v ^# ; then echo "Am:2345:respawn:/sbin/getty $ttyS 115200 vt100-nav" >> /etc/inittab init q @@ -15,7 +17,7 @@ tmp=/tmp/menu.lst if ! grep '^# kopt=' $grub | grep console= ; then - cat $grub | sed "s/^\(# kopt=.*\)$/\1 console=$ttyS,115200/" > $tmp + cat $grub | sed "s/^\(# kopt=.*\)$/\1 console=$ttyS,115200 console=tty0/" > $tmp else cat $grub > $tmp fi @@ -23,8 +25,7 @@ if ! grep 'terminal *serial' $grub ; then port=`dmesg | grep ttyS | grep 0xe | sed 's/^.*\(0xe[0-9a-f]*\).*$/\1/'` - echo "serial --port=$port --speed=115200" >> $tmp - echo "terminal serial" >> $tmp + cat $tmp | sed "s/\(### BEGIN AUTOMAGIC KERNELS LIST\)/serial --port=$port --speed=115200\nterminal serial\n\n\1/" >> $tmp.serial && mv $tmp.serial $tmp || exit fi if ! diff -urw $grub $tmp ; then