From 1c1160959b8ac8f2ea5a93069fd4ac55ef668408 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Sun, 16 Jul 2023 01:00:31 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E6=B7=BB=E5=8A=A0=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E5=88=B0=20ttyAMA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trans.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/trans.sh b/trans.sh index f4425ba..e42574e 100644 --- a/trans.sh +++ b/trans.sh @@ -121,13 +121,13 @@ setup_tty_and_log() {
 EOF
     # 显示输出到前台
-    # 似乎script更优雅,但 alpine 不带 script 命令
     # script -f /dev/tty0
-    if [ -e /dev/ttyS0 ]; then
-        exec > >(tee -a /dev/tty0 /dev/ttyS0 /reinstall.html) 2>&1
-    else
-        exec > >(tee -a /dev/tty0 /reinstall.html) 2>&1
-    fi
+    for t in /dev/tty0 /dev/ttyS0 /dev/ttyAMA0; do
+        if [ -e $t ] && echo >$t 2>/dev/null; then
+            ttys="$ttys $t"
+        fi
+    done
+    exec > >(tee -a $ttys /reinstall.html) 2>&1
 }
 
 extract_env_from_cmdline() {