diff options
Diffstat (limited to 'system/gettys-openrc/gettys.initd')
-rw-r--r-- | system/gettys-openrc/gettys.initd | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/system/gettys-openrc/gettys.initd b/system/gettys-openrc/gettys.initd index cf74b0e8a..5181d9af2 100644 --- a/system/gettys-openrc/gettys.initd +++ b/system/gettys-openrc/gettys.initd @@ -14,25 +14,47 @@ makeservice() { if test -z "$baud" ; then baud=38400 fi - mkdir -p -m 0755 "/run/early-services/getty-$tty" + mkdir -p -m 0755 "/var/lib/s6/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" + } > "/var/lib/s6/services/getty-$tty/run" + chmod 0755 "/var/lib/s6/services/getty-$tty/run" } -start() -{ +nomatchname() { + for j in $GETTYS ; do + if test "$j" = "$1" ; then + return 1 + fi + done + return 0 +} + +start() { set -e - mkdir -m 0755 -p /run/early-services + ebegin "Applying getty configuration" . /etc/conf.d/gettys + + todel="" + for i in `ls -1 /var/lib/s6/services | grep ^getty-` ; do + if nomatchname "${i##getty-}" ; then + rm -f "/run/service/$i" + todel="$todel $i" + fi + done + for i in $GETTYS ; do if test -c /dev/"$i" ; then - ebegin "Creating getty service for $i" - makeservice "$i" - eend $? + makeservice "$i" + ln -nsf "/var/lib/s6/services/getty-$i" "/run/service/getty-$i" fi done + + s6-svscanctl -an /run/service + if test -n "$todel" ; then + ( sleep 1 && rm -rf $todel ) & + fi + eend $? } |