diff --git a/config/boards/orangepi5.conf b/config/boards/orangepi5.conf index 74454569a..17c5ad527 100644 --- a/config/boards/orangepi5.conf +++ b/config/boards/orangepi5.conf @@ -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 diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc index ce0e09ce4..57a269e6e 100644 --- a/config/sources/families/include/rockchip64_common.inc +++ b/config/sources/families/include/rockchip64_common.inc @@ -315,8 +315,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 @@ -332,7 +332,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