meta-google: gbmc-bridge: fail upgrade when url is invalid
Currently the upgrade will continue when there is no url. This change
will stop self update if the url is empty/invalid.
Change-Id: I465ee426c845b918aa458b24db89fbcc2795cde5
Signed-off-by: Yuxiao Zhang <yuxiaozhang@google.com>
diff --git a/meta-google/recipes-phosphor/flash/gbmc-update/40-gbmc-upgrade.sh b/meta-google/recipes-phosphor/flash/gbmc-update/40-gbmc-upgrade.sh
index 0b927f0..3ac4020 100644
--- a/meta-google/recipes-phosphor/flash/gbmc-update/40-gbmc-upgrade.sh
+++ b/meta-google/recipes-phosphor/flash/gbmc-update/40-gbmc-upgrade.sh
@@ -78,8 +78,14 @@
local tmpdir
tmpdir="$(mktemp -d)" || return
+ if ! gbmc_upgrade_dl_unpack; then
+ echo 'upgrade unpack failed' >&2
+ # shellcheck disable=SC2153
+ rm -rf -- "$tmpdir" "$GBMC_UPGRADE_SIG" "$GBMC_UPGRADE_IMG"
+ return 1
+ fi
# shellcheck disable=SC2015
- gbmc_upgrade_dl_unpack && gbmc_br_run_hooks GBMC_UPGRADE_HOOKS || true
+ gbmc_br_run_hooks GBMC_UPGRADE_HOOKS || true
# shellcheck disable=SC2153
rm -rf -- "$tmpdir" "$GBMC_UPGRADE_SIG" "$GBMC_UPGRADE_IMG"
}