Use existing securetty

Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
Avi Deitcher
2017-07-10 11:21:31 +03:00
parent 09836c87e5
commit 5d18cba75f
12 changed files with 25 additions and 11 deletions

View File

@@ -35,7 +35,8 @@ start_getty() {
fi
if ! grep -q -w "$tty" "$securetty"; then
echo "$tty" >> "$securetty"
# we could not find the tty in securetty, so start a getty but warn that root login will not work
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." > /dev/$tty
fi
# respawn forever
infinite_loop setsid.getty -w /sbin/agetty $loginargs $line $speed $tty $term &
@@ -49,6 +50,13 @@ if [ -f $ROOTSHADOW ]; then
echo >> /etc/shadow
fi
ROOTSTTY=/hostroot/etc/securetty
if [ -f $ROOTSTTY ]; then
cp $ROOTSTTY /etc/securetty
# just in case someone forgot a newline
echo >> /etc/securetty
fi
for opt in $(cat /proc/cmdline); do
case "$opt" in
console=*)