summaryrefslogtreecommitdiff
path: root/system/s6-linux-init/earlygetty.run
diff options
context:
space:
mode:
Diffstat (limited to 'system/s6-linux-init/earlygetty.run')
-rw-r--r--system/s6-linux-init/earlygetty.run31
1 files changed, 31 insertions, 0 deletions
diff --git a/system/s6-linux-init/earlygetty.run b/system/s6-linux-init/earlygetty.run
new file mode 100644
index 000000000..809fac747
--- /dev/null
+++ b/system/s6-linux-init/earlygetty.run
@@ -0,0 +1,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"