Update alpineInit.sh

This commit is contained in:
Molly Lau 2023-10-24 20:10:00 +09:00 committed by GitHub
parent d31bc612a6
commit f290099ea3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,9 +2,15 @@
#
# Alpine Linux use "ash" as the default shell.
exec >/dev/tty0 2>&1
exec >/dev/ttyS0 2>&1
exec >/dev/ttyAMA0 2>&1
# Find available tty.
# Parameters of outputs of "stty": https://www.ibm.com/docs/en/aix/7.3?topic=s-stty-command
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
insertIntoFile() {
file=$1