]> git.siccegge.de Git - forks/vmdebootstrap.git/blob - examples/auto-serial-console
Create useable fstab for kfreebsd systems
[forks/vmdebootstrap.git] / examples / auto-serial-console
1 #!/bin/sh -e
2
3 [ -f /etc/default/autogetty ] && . /etc/default/autogetty
4
5 [ 1 -gt $ENABLED ] && exit
6
7 for arg in $(cat /proc/cmdline)
8 do
9 case $arg in
10 console=*)
11 tty=${arg#console=}
12 tty=${tty#/dev/}
13
14 case $tty in
15 tty[a-zA-Z]* )
16 PORT=${tty%%,*}
17
18 # check for service which do something on this port
19 if [ -f /etc/init/$PORT.conf ];then continue;fi
20
21 tmp=${tty##$PORT,}
22 SPEED=${tmp%%n*}
23 BITS=${tmp##${SPEED}n}
24
25 # 8bit serial is default
26 [ -z $BITS ] && BITS=8
27 [ 8 -eq $BITS ] && GETTY_ARGS="$GETTY_ARGS -8 "
28
29 [ -z $SPEED ] && SPEED='115200,57600,38400,19200,9600'
30
31 GETTY_ARGS="$AUTOGETTY_ARGS $GETTY_ARGS $SPEED $PORT"
32 exec /sbin/getty $GETTY_ARGS
33 esac
34 esac
35 done