From 3d3f3488e0f24b839919c3e71ed00270194e5024 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Sun, 26 Apr 2026 21:59:07 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E4=B8=8D=E9=9C=80=E8=A6=81=E5=88=A4?= =?UTF-8?q?=E6=96=AD=20tty=20=E8=83=BD=E5=90=A6=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 而且安装环境下 tty 不一定齐全 --- ttys.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/ttys.sh b/ttys.sh index 630873f..122279d 100644 --- a/ttys.sh +++ b/ttys.sh @@ -7,27 +7,24 @@ prefix=$1 # 注意 debian initrd 没有 xargs # 最后一个 tty 是主 tty,显示的信息最全 -is_first=true if [ "$(uname -m)" = "aarch64" ]; then ttys="ttyS0 ttyAMA0 tty0" else ttys="ttyS0 tty0" fi +is_first=true for tty in $ttys; do - # hytron 有ttyS0 但无法写入 - if stty -g -F "/dev/$tty" >/dev/null 2>&1; then - if $is_first; then - is_first=false - else - printf " " - fi + if $is_first; then + is_first=false + else + printf " " + fi - printf "%s" "$prefix$tty" + printf "%s" "$prefix$tty" - if [ "$prefix" = "console=" ] && - { [ "$tty" = ttyS0 ] || [ "$tty" = ttyAMA0 ]; }; then - printf ",115200n8" - fi + if [ "$prefix" = "console=" ] && + { [ "$tty" = ttyS0 ] || [ "$tty" = ttyAMA0 ]; }; then + printf ",115200n8" fi done