/[sysadmin-cookbook]/recepies/amt/serial-console.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /recepies/amt/serial-console.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 135 - (hide annotations)
Tue Aug 25 17:48:56 2009 UTC (14 years, 8 months ago) by dpavlin
File MIME type: application/x-sh
File size: 951 byte(s)
use last serial port (so we can use normal serials too)
make grub modification optional

1 dpavlin 75 #!/bin/sh -x
2    
3     # add AMT serial console to inittab
4    
5 dpavlin 135 ttyS=`dmesg | grep ttyS | grep 0x | tail -1 | sed 's/^.*\(ttyS[0-9]\).*$/\1/'`
6 dpavlin 75
7 dpavlin 87 test -z "$ttyS" && echo "Can't find serial port in dmesg output" && exit
8    
9 dpavlin 135 if ! grep $ttyS /etc/inittab | grep -v ^# ; then
10 dpavlin 75 echo "Am:2345:respawn:/sbin/getty $ttyS 115200 vt100-nav" >> /etc/inittab
11     init q
12     fi
13    
14     ps ax | grep $ttyS | grep -v grep
15 dpavlin 76
16     grub=/boot/grub/menu.lst
17 dpavlin 77 tmp=/tmp/menu.lst
18 dpavlin 76
19 dpavlin 135 test -f $grub || exit
20    
21 dpavlin 76 if ! grep '^# kopt=' $grub | grep console= ; then
22 dpavlin 89 cat $grub | sed "s/^\(# kopt=.*\)$/\1 console=$ttyS,115200 console=tty0/" > $tmp
23 dpavlin 77 else
24     cat $grub > $tmp
25 dpavlin 76 fi
26 dpavlin 77
27    
28     if ! grep 'terminal *serial' $grub ; then
29     port=`dmesg | grep ttyS | grep 0xe | sed 's/^.*\(0xe[0-9a-f]*\).*$/\1/'`
30 dpavlin 89 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
31 dpavlin 77 fi
32    
33     if ! diff -urw $grub $tmp ; then
34     mv $tmp $grub && update-grub
35     fi

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26