Skip to content

Commit ee9e512

Browse files
committed
rockchip64: check whether the terminal is interactive during write_uboot_platform_mtd process
1 parent d7e70c8 commit ee9e512

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

config/boards/orangepi5.conf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ function post_family_config__orangepi5_use_mainline_uboot() {
5959
((i++))
6060
done <<< "$FILES"
6161

62-
# If there is only one image, we can skip the dialog
63-
if [[ $i -eq 2 ]]; then
62+
# If there is only one image or the terminal is not interactive, we can skip the dialog
63+
if [[ ! -t 1 || $i -eq 2 ]]; then
6464
flashcp -v -p "$1/${MENU_ITEMS[1]}" /dev/mtd0
6565
return
6666
fi
@@ -76,7 +76,8 @@ function post_family_config__orangepi5_use_mainline_uboot() {
7676
3>&1 1>&2 2>&3)
7777

7878
if [ $? -eq 0 ]; then
79-
flashcp -v -p "$1/${MENU_ITEMS[($CHOICE*3)-2]}" /dev/mtd0
79+
idx=$((CHOICE*3-2))
80+
flashcp -v -p "$1/${MENU_ITEMS[$idx]}" /dev/mtd0
8081
else
8182
echo "No SPI image chosen."
8283
exit 1

config/sources/families/include/rockchip64_common.inc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ write_uboot_platform_mtd() {
315315
((i++))
316316
done <<< "$FILES"
317317

318-
# If there is only one image, we can skip the dialog
319-
if [[ $i -eq 2 ]]; then
318+
# If there is only one image or the terminal is not interactive, we can skip the dialog
319+
if [[ ! -t 1 || $i -eq 2 ]]; then
320320
dd if=$1/${MENU_ITEMS[1]} of=$2 conv=notrunc status=none > /dev/null 2>&1
321321
return
322322
fi
@@ -332,7 +332,8 @@ write_uboot_platform_mtd() {
332332
3>&1 1>&2 2>&3)
333333

334334
if [ $? -eq 0 ]; then
335-
dd if=$1/${MENU_ITEMS[($CHOICE*3)-2]} of=$2 conv=notrunc status=none > /dev/null 2>&1
335+
idx=$((CHOICE*3-2))
336+
dd if=$1/${MENU_ITEMS[$idx]} of=$2 conv=notrunc status=none > /dev/null 2>&1
336337
else
337338
echo "No SPI image chosen."
338339
exit 1

0 commit comments

Comments
 (0)