blob: f60409eae3afccd56cdf518920bfa766b2ec04fc [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001#!/bin/sh
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002
Brad Bishop19323692019-04-05 15:28:33 -04003# 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
Patrick Williams92b42cb2022-09-03 06:53:57 -050012 options=""
Brad Bishop19323692019-04-05 15:28:33 -040013 ;;
14esac
15
Andrew Geisslerc926e172021-05-07 16:11:35 -050016if [ -e /sys/class/tty/$2 -a -c /dev/$2 ]; then
Patrick Williams92b42cb2022-09-03 06:53:57 -050017 ${setsid:-} ${getty} ${options:-} -L $1 $2 $3
18else
19 # Prevent respawning to fast error if /dev entry does not exist
20 sleep 1000
Andrew Geisslerc926e172021-05-07 16:11:35 -050021fi