xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2
3# busybox' getty does this itself, util-linux' agetty needs extra help
4getty="/sbin/getty"
5case $(readlink -f "${getty}") in
6    */busybox*)
7        ;;
8    *)
9        if [ -x "/usr/bin/setsid" ] ; then
10            setsid="/usr/bin/setsid"
11        fi
12        ;;
13esac
14
15if [ -e /sys/class/tty/$2 -a -c /dev/$2 ]; then
16	${setsid:-} ${getty} -L $1 $2 $3
17else
18    # Prevent respawning to fast error if /dev entry does not exist
19    sleep 1000
20fi
21