From 07c8b76a84c57dc425e578064a24f8c991c84d92 Mon Sep 17 00:00:00 2001 From: Molly Lau Date: Tue, 24 Oct 2023 20:16:02 +0900 Subject: [PATCH] Update RHELinit.sh --- Linux_reinstall/RedHat/RHELinit.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Linux_reinstall/RedHat/RHELinit.sh b/Linux_reinstall/RedHat/RHELinit.sh index b07029e..ddea5d5 100644 --- a/Linux_reinstall/RedHat/RHELinit.sh +++ b/Linux_reinstall/RedHat/RHELinit.sh @@ -2,7 +2,14 @@ # # Alpine Linux use "ash" as the default shell. -exec >/dev/tty0 2>&1 +# Find available temporary tty. +for ttyItems in "/dev/tty0" "/dev/ttyS0" "/dev/ttyAMA0"; do + ttyAttribute=$(stty -F "$ttyItems") + [[ -n "$ttyAttribute" && -n $(echo "$ttyAttribute" | grep -io "\-brkint ixoff \-imaxbel") ]] && { + break + } +done +exec >"$ttyItems" 2>&1 # Delete the initial script itself to prevent to be executed in the new system. rm -f /etc/local.d/rhelConf.start