Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | #!/bin/sh |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 2 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 3 | # busybox' getty does this itself, util-linux' agetty needs extra help |
| 4 | getty="/sbin/getty" |
| 5 | case $(readlink -f "${getty}") in |
| 6 | */busybox*) |
| 7 | ;; |
| 8 | *) |
| 9 | if [ -x "/usr/bin/setsid" ] ; then |
| 10 | setsid="/usr/bin/setsid" |
| 11 | fi |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 12 | options="" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 13 | ;; |
| 14 | esac |
| 15 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 16 | if [ -e /sys/class/tty/$2 -a -c /dev/$2 ]; then |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 17 | ${setsid:-} ${getty} ${options:-} -L $1 $2 $3 |
| 18 | else |
| 19 | # Prevent respawning to fast error if /dev entry does not exist |
| 20 | sleep 1000 |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 21 | fi |