Skip to content

Commit 97466bd

Browse files
authored
Merge pull request #2058 from tlaurion/show_progress_if_flashtool_support_progress_in_oem-factory-reset
oem-factory-reset: improve firmware read UX and error logging
2 parents 373294a + bed0ed0 commit 97466bd

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

initrd/bin/oem-factory-reset

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,8 +1375,16 @@ else
13751375
#We are not running in QEMU, so flash the key to ROM
13761376

13771377
## flash generated key to ROM
1378-
echo -e "\nReading current firmware...\n(this may take up to two minutes...)\n"
1379-
/bin/flash.sh -r /tmp/oem-setup.rom >/dev/null 2>/tmp/error
1378+
# read current firmware; show all output and capture stderr for errors
1379+
if echo "$CONFIG_FLASH_OPTIONS" | grep -q -- '--progress'; then
1380+
echo -e "\nReading current firmware (progress shown below)...\n"
1381+
else
1382+
echo -e "\nReading current firmware...\n(this may take up to two minutes...)\n"
1383+
fi
1384+
if ! /bin/flash.sh -r /tmp/oem-setup.rom 2> >(tee /tmp/error >&2); then
1385+
ERROR=$(tail -n 1 /tmp/error | fold -s)
1386+
whiptail_error_die "Error reading current firmware:\n\n$ERROR"
1387+
fi
13801388
if [ ! -s /tmp/oem-setup.rom ]; then
13811389
ERROR=$(tail -n 1 /tmp/error | fold -s)
13821390
whiptail_error_die "Error reading current firmware:\n\n$ERROR"

0 commit comments

Comments
 (0)