mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 18:11:35 +00:00
Keep track of processed ttys and only start same one once
Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
parent
aa0a76b58b
commit
49ffa978d3
@ -15,6 +15,14 @@ start_getty() {
|
|||||||
term="linux"
|
term="linux"
|
||||||
[ "$speed" = "$1" ] && speed=115200
|
[ "$speed" = "$1" ] && speed=115200
|
||||||
|
|
||||||
|
# did we already process this tty?
|
||||||
|
if $(echo "${PROCESSEDTTY}" | grep -q -w "$tty"); then
|
||||||
|
echo "getty: already processed tty for $tty, not starting twice" | tee /dev/console
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
# now indicate that we are processing it
|
||||||
|
PROCESSEDTTY="${PROCESSEDTTY} ${tty}"
|
||||||
|
|
||||||
# does the device even exist?
|
# does the device even exist?
|
||||||
if [ ! -c /dev/$tty ]; then
|
if [ ! -c /dev/$tty ]; then
|
||||||
echo "getty: cmdline has console=$tty but /dev/$tty is not a character device; not starting getty for $tty" | tee /dev/console
|
echo "getty: cmdline has console=$tty but /dev/$tty is not a character device; not starting getty for $tty" | tee /dev/console
|
||||||
@ -44,6 +52,7 @@ start_getty() {
|
|||||||
echo "getty: cmdline has console=$tty but does not exist in $securetty; will not be able to log in as root on this tty $tty." | tee /dev/$tty
|
echo "getty: cmdline has console=$tty but does not exist in $securetty; will not be able to log in as root on this tty $tty." | tee /dev/$tty
|
||||||
fi
|
fi
|
||||||
# respawn forever
|
# respawn forever
|
||||||
|
echo "getty: starting getty for $tty" | tee /dev/$tty
|
||||||
infinite_loop setsid.getty -w /sbin/agetty $loginargs $line $speed $tty $term &
|
infinite_loop setsid.getty -w /sbin/agetty $loginargs $line $speed $tty $term &
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +64,8 @@ export PS1="(ns: getty) $PS1"
|
|||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
PROCESSEDTTY=
|
||||||
|
|
||||||
# check if we have /etc/getty.shadow
|
# check if we have /etc/getty.shadow
|
||||||
ROOTSHADOW=/hostroot/etc/getty.shadow
|
ROOTSHADOW=/hostroot/etc/getty.shadow
|
||||||
if [ -f $ROOTSHADOW ]; then
|
if [ -f $ROOTSHADOW ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user