summaryrefslogtreecommitdiff
path: root/system/s6-linux-init/earlygetty.run
diff options
context:
space:
mode:
authorLaurent Bercot <ska-adelie@skarnet.org>2019-10-03 10:31:29 -0500
committerLaurent Bercot <ska-adelie@skarnet.org>2019-10-03 10:31:29 -0500
commit2c782daf6fae1b418168a5e8a9336fe9e6b9215e (patch)
tree8b749945bc1d8baca29d60e573ceadbab69e8c6f /system/s6-linux-init/earlygetty.run
parent7fabe3e35d27fd34b780d135ac09b846a4083257 (diff)
downloadpackages-2c782daf6fae1b418168a5e8a9336fe9e6b9215e.tar.gz
packages-2c782daf6fae1b418168a5e8a9336fe9e6b9215e.tar.bz2
packages-2c782daf6fae1b418168a5e8a9336fe9e6b9215e.tar.xz
packages-2c782daf6fae1b418168a5e8a9336fe9e6b9215e.zip
system/s6-linux-init: make early getty configurable. PLEASE REVIEW.
Also touches gettys-openrc to avoid spawning the same getty twice.
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"