rockchip64: check whether the terminal is interactive during write_uboot_platform_mtd process

This commit is contained in:
Muhammed Efe Cetin 2025-05-25 21:44:13 +03:00 committed by Igor
parent a8f4db3253
commit b3f0e43d00
2 changed files with 8 additions and 6 deletions

View File

@ -59,8 +59,8 @@ function post_family_config__orangepi5_use_mainline_uboot() {
((i++))
done <<< "$FILES"
# If there is only one image, we can skip the dialog
if [[ $i -eq 2 ]]; then
# If there is only one image or the terminal is not interactive, we can skip the dialog
if [[ ! -t 1 || $i -eq 2 ]]; then
flashcp -v -p "$1/${MENU_ITEMS[1]}" /dev/mtd0
return
fi
@ -76,7 +76,8 @@ function post_family_config__orangepi5_use_mainline_uboot() {
3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then
flashcp -v -p "$1/${MENU_ITEMS[($CHOICE*3)-2]}" /dev/mtd0
idx=$((CHOICE*3-2))
flashcp -v -p "$1/${MENU_ITEMS[$idx]}" /dev/mtd0
else
echo "No SPI image chosen."
exit 1

View File

@ -323,8 +323,8 @@ write_uboot_platform_mtd() {
((i++))
done <<< "$FILES"
# If there is only one image, we can skip the dialog
if [[ $i -eq 2 ]]; then
# If there is only one image or the terminal is not interactive, we can skip the dialog
if [[ ! -t 1 || $i -eq 2 ]]; then
dd if=$1/${MENU_ITEMS[1]} of=$2 conv=notrunc status=none > /dev/null 2>&1
return
fi
@ -340,7 +340,8 @@ write_uboot_platform_mtd() {
3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then
dd if=$1/${MENU_ITEMS[($CHOICE*3)-2]} of=$2 conv=notrunc status=none > /dev/null 2>&1
idx=$((CHOICE*3-2))
dd if=$1/${MENU_ITEMS[$idx]} of=$2 conv=notrunc status=none > /dev/null 2>&1
else
echo "No SPI image chosen."
exit 1