summaryrefslogtreecommitdiff
path: root/system/s6-linux-init/earlygetty.run
blob: 809fac74713fc30b4381e31cbb61d0ceaead63dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh -e

tty=tty2
baud=
options='-L'

if line=`head -n 1 /run/kernel_env/earlygetty` ; then
  tty="${line%%,*}"
  bpnf="${line##*,}"
  nf=
  f=
  clean=false
  case "$bpnf" in
    *n*) baud=${bpnf%%n*} ; nf="${bpnf##*n}" ; clean=true ;;
    *o*) baud=${bpnf%%o*} ; nf="${bpnf##*o}" ;;
    *e*) baud=${bpnf%%e*} ; nf="${bpnf##*e}" ;;
    [[:digit:]]*) baud=$bpnf
  esac
  case "$nf" in
    7*) clean=false ; f="${nf#7}" ;;
    [[:digit:]]*) clean=true ; f="${nf#?}"
  esac
  if $clean ; then
    options="$options -8"
  fi
  if test "$f" = 'r' ; then
    options="$options -h"
  fi
fi

exec /sbin/agetty $options -- "$tty" "$baud"