diff options
author | Laurent Bercot <ska-adelie@skarnet.org> | 2018-08-19 21:31:04 +0000 |
---|---|---|
committer | Laurent Bercot <ska-adelie@skarnet.org> | 2018-08-19 21:31:04 +0000 |
commit | 54d8b12cfe5b6028b5e1152ba1627878d3657a6b (patch) | |
tree | 1d39f5f0a53a184403fc87bf543f847145f650fd /system/gettys-openrc/gettys.initd | |
parent | cb085205ea9982a9857c0d06967314c29b17e811 (diff) | |
download | packages-54d8b12cfe5b6028b5e1152ba1627878d3657a6b.tar.gz packages-54d8b12cfe5b6028b5e1152ba1627878d3657a6b.tar.bz2 packages-54d8b12cfe5b6028b5e1152ba1627878d3657a6b.tar.xz packages-54d8b12cfe5b6028b5e1152ba1627878d3657a6b.zip |
system/gettys-openrc: new package. Move all getty definitions to it.
Small change to system/adelie-base so it includes gettys-openrc.
Small change to system/s6 so it doesn't statically define gettys.
Diffstat (limited to 'system/gettys-openrc/gettys.initd')
-rw-r--r-- | system/gettys-openrc/gettys.initd | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/system/gettys-openrc/gettys.initd b/system/gettys-openrc/gettys.initd new file mode 100644 index 000000000..cf74b0e8a --- /dev/null +++ b/system/gettys-openrc/gettys.initd @@ -0,0 +1,38 @@ +#!/sbin/openrc-run + +description="Create s6 services for gettys on user-chosen terminals" + +depend() { + after dev-mount +} + +makeservice() { + set -e + tty="$1" + eval 'options="$GETTYS_'"$tty"'_OPTIONS"' + eval 'baud="$GETTYS_'"$tty"'_BAUDRATE"' + if test -z "$baud" ; then + baud=38400 + fi + mkdir -p -m 0755 "/run/early-services/getty-$tty" + { + echo '#!/bin/execlineb -P' + echo + echo "/sbin/agetty $options -- $baud $tty linux" + } > "/run/early-services/getty-$tty/run" + chmod 0755 "/run/early-services/getty-$tty/run" +} + +start() +{ + set -e + mkdir -m 0755 -p /run/early-services + . /etc/conf.d/gettys + for i in $GETTYS ; do + if test -c /dev/"$i" ; then + ebegin "Creating getty service for $i" + makeservice "$i" + eend $? + fi + done +} |