#!/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 }