From 6ab4179bae91bf0cc944e8ec3adc936cef7935a6 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Mon, 28 Sep 2020 22:03:53 +0100 Subject: [PATCH] rpi-eeprom-config: Trap errors when deleting previous update files --- rpi-eeprom-update | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 6c251d5..f693e8d 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -631,14 +631,16 @@ removePreviousUpdates() if [ "$(id -u)" = "0" ]; then findBootFS - # Remove any stale recovery.bin files or EEPROM images - # N.B. recovery.bin is normally ignored by the ROM if is not a valid - # executable but it's best to not have the file at all. - rm -f "${BOOTFS}/recovery.bin" - rm -f "${BOOTFS}/pieeprom.bin" "${BOOTFS}/pieeprom.upd" "${BOOTFS}/pieeprom.sig" - rm -f "${BOOTFS}/vl805.bin" "${BOOTFS}/vl805.sig" - # Case insensitive for FAT bootfs - find "${BOOTFS}" -maxdepth 1 -type f -follow -iname "recovery.*" -regex '.*\.[0-9][0-9][0-9]$' -exec rm -f {} \; + ( + # Remove any stale recovery.bin files or EEPROM images + # N.B. recovery.bin is normally ignored by the ROM if is not a valid + # executable but it's best to not have the file at all. + rm -f "${BOOTFS}/recovery.bin" + rm -f "${BOOTFS}/pieeprom.bin" "${BOOTFS}/pieeprom.upd" "${BOOTFS}/pieeprom.sig" + rm -f "${BOOTFS}/vl805.bin" "${BOOTFS}/vl805.sig" + # Case insensitive for FAT bootfs + find "${BOOTFS}" -maxdepth 1 -type f -follow -iname "recovery.*" -regex '.*\.[0-9][0-9][0-9]$' -exec rm -f {} \; + ) || die "Failed to remove previous update files" fi }