summaryrefslogtreecommitdiff
path: root/system/gettys-openrc/gettys.initd
blob: cf74b0e8a9f052531e7c00aec99afd89de8e959a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
}