update-fw scripts: fix error path after sucessful update

On commit 1e5cafeb79 a fall-back
update command was introduced in case the newest command fails.
If the newest command succeeds, however, the 'test' command for
error doesn't match (there is no error) and the return code of
such test is "1". On the next check for errors, this results on
an error, when we really mean to continue because the first
command was successful.

Move the second error check inside the error path of the first
attempt.

Reported-by: Francisco Gil <francisco.gilmartinez@digi.com>
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2021-01-18 11:55:28 +01:00
parent 95be080ab2
commit fddaee85b9
10 changed files with 60 additions and 60 deletions

View File

@ -86,12 +86,12 @@ update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will

View File

@ -86,12 +86,12 @@ update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will

View File

@ -86,12 +86,12 @@ update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will

View File

@ -86,12 +86,12 @@ update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will

View File

@ -57,12 +57,12 @@ update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will

View File

@ -57,12 +57,12 @@ update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will

View File

@ -128,12 +128,12 @@ update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will

View File

@ -126,12 +126,12 @@ update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will

View File

@ -128,12 +128,12 @@ update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will

View File

@ -128,12 +128,12 @@ update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
fi
if test $? -eq 1; then
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
fi
# Set 'bootcmd' to the second part of the script that will