File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,8 @@ function post_family_config__orangepi5_use_mainline_uboot() {
59
59
((i++))
60
60
done <<< "$FILES"
61
61
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
64
64
flashcp -v -p "$1/${MENU_ITEMS[1]}" /dev/mtd0
65
65
return
66
66
fi
@@ -76,7 +76,8 @@ function post_family_config__orangepi5_use_mainline_uboot() {
76
76
3>&1 1>&2 2>&3)
77
77
78
78
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
80
81
else
81
82
echo "No SPI image chosen."
82
83
exit 1
Original file line number Diff line number Diff line change @@ -315,8 +315,8 @@ write_uboot_platform_mtd() {
315
315
((i++ ))
316
316
done << < " $FILES"
317
317
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
320
320
dd if = $1 / ${MENU_ITEMS[1 ]} of = $2 conv= notrunc status= none > / dev/ null 2 > & 1
321
321
return
322
322
fi
@@ -332,7 +332,8 @@ write_uboot_platform_mtd() {
332
332
3 > & 1 1 > & 2 2 > & 3 )
333
333
334
334
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
336
337
else
337
338
echo " No SPI image chosen."
338
339
exit 1
You can’t perform that action at this time.
0 commit comments