]> code.ossystems Code Review - openembedded-core.git/commitdiff
sysvinit-inittab: Add support for tty devices with 10 or more number.
authorYuki Hoshino <yuki.hoshino@miraclelinux.com>
Fri, 12 Jun 2020 08:16:57 +0000 (08:16 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 12 Jun 2020 17:12:46 +0000 (18:12 +0100)
"start_getty" support for tty devices with under 10 number.
When SERIAL_CONSOLES has tty devices with 10 or more number,
do not't start getty and output the following message.
----------
sh 1: unknown operand
----------

Signed-off-by: Yuki Hoshino <yuki.hoshino@miraclelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/sysvinit/sysvinit-inittab/start_getty

index 96fd6cfcfd0bc47bce6fc9613d46fccf9a08919b..dfa799adac2e8cb17ff11defb234016684681b70 100644 (file)
@@ -11,7 +11,7 @@
 active_serial=$(grep "serial" /proc/tty/drivers | cut -d/ -f1 | sed "s/ *$//")
 
 # Rephrase input parameter from ttyS target index (ttyS1, ttyS2, ttyAMA0, etc).
-runtime_tty=$(echo $2 | grep -oh '[0-9]')
+runtime_tty=$(echo $2 | grep -oh '[0-9]\+')
 
 # busybox' getty does this itself, util-linux' agetty needs extra help
 getty="/sbin/getty"
@@ -36,7 +36,7 @@ for line in $active_serial; do
         then
                # Remove all unknown entries and discard the first line (desc).
                activetty=$(grep -v "unknown" "/proc/tty/driver/$line" \
-                           | tail -n +2 | grep -oh "^\s*\S*[0-9]")
+                           | tail -n +2 | grep -oh "^\s*\S*[0-9]\+")
                for active in $activetty; do
                        # If indexes do match then enable the serial console.
                        if [ $active -eq $runtime_tty ]