/[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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 76 by dpavlin, Sun May 17 11:50:30 2009 UTC revision 87 by dpavlin, Mon May 18 08:26:23 2009 UTC
# Line 4  Line 4 
4    
5  ttyS=`dmesg | grep ttyS | grep 0xe | sed 's/^.*\(ttyS[0-9]\).*$/\1/'`  ttyS=`dmesg | grep ttyS | grep 0xe | sed 's/^.*\(ttyS[0-9]\).*$/\1/'`
6    
7    test -z "$ttyS" && echo "Can't find serial port in dmesg output" && exit
8    
9  if ! grep ttyS1 /etc/inittab | grep -v ^# ; then  if ! grep ttyS1 /etc/inittab | grep -v ^# ; then
10          echo "Am:2345:respawn:/sbin/getty $ttyS 115200 vt100-nav" >> /etc/inittab          echo "Am:2345:respawn:/sbin/getty $ttyS 115200 vt100-nav" >> /etc/inittab
11          init q          init q
# Line 12  fi Line 14  fi
14  ps ax | grep $ttyS | grep -v grep  ps ax | grep $ttyS | grep -v grep
15    
16  grub=/boot/grub/menu.lst  grub=/boot/grub/menu.lst
17    tmp=/tmp/menu.lst
18    
19  if ! grep '^# kopt=' $grub | grep console= ; then  if ! grep '^# kopt=' $grub | grep console= ; then
20          cat $grub | sed "s/^\(# kopt=.*\)$/\1 console=$ttyS,115200/" > $grub.serial          cat $grub | sed "s/^\(# kopt=.*\)$/\1 console=$ttyS,115200/" > $tmp
21          diff -urw $grub $grub.serial  else
22            cat $grub > $tmp
23    fi
24    
25    
26    if ! grep 'terminal *serial' $grub ; then
27            port=`dmesg | grep ttyS | grep 0xe | sed 's/^.*\(0xe[0-9a-f]*\).*$/\1/'`
28            echo "serial --port=$port --speed=115200" >> $tmp
29            echo "terminal serial" >> $tmp
30    fi
31    
32    if ! diff -urw $grub $tmp ; then
33            mv $tmp $grub && update-grub
34  fi  fi

Legend:
Removed from v.76  
changed lines
  Added in v.87

  ViewVC Help
Powered by ViewVC 1.1.26