From 70244c7f99bd1eb31b759930b20ce2b9c0da4bd7 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Mon, 1 Jun 2026 00:11:40 +0800 Subject: [PATCH] =?UTF-8?q?core:=20cmdline=20=E6=98=8E=E7=A1=AE=E6=8E=92?= =?UTF-8?q?=E9=99=A4=E4=B8=8D=E5=8F=AF=E5=86=99=E7=9A=84=20tty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #620 --- ttys.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ttys.sh b/ttys.sh index 3fba00f..d2c5e42 100644 --- a/ttys.sh +++ b/ttys.sh @@ -15,16 +15,23 @@ fi # 安装环境下 tty 不一定齐全 # hytron 有ttyS0 但无法写入 -# 用于 cmdline 引导参数时不需要判断 tty 是否存在和可写 +# 用于 cmdline 引导参数时,明确排除不可写的 tty,避免 getty 反复重启 +# https://github.com/bin456789/reinstall/issues/620 + if [ "$prefix" = "console=" ]; then is_for_cmdline=true else is_for_cmdline=false fi +# 用途 条件 +# 安装日志 存在且可写 +# console 存在且可写 或 不存在(因为安装环境下 tty 不一定齐全) + is_first=true for tty in $ttys; do - if $is_for_cmdline || stty -g -F "/dev/$tty" >/dev/null 2>&1; then + if { [ -c "/dev/$tty" ] && stty -g -F "/dev/$tty" >/dev/null 2>&1; } || + { $is_for_cmdline && ! [ -c "/dev/$tty" ]; }; then if $is_first; then is_first=false else