From 5b26b7901a75e61f3624533f9feefba0aac0770c Mon Sep 17 00:00:00 2001 From: Eduardo Ferreira Date: Thu, 9 Jan 2025 09:52:41 -0300 Subject: [PATCH] grub-ota-fallback: fix some issues on grub fallback logic script Corrected the comparison '"${upgrade_available}" = "1"', which was missing an '=' sign. Also changed the logic 'if [ "${bootcount}" == "${bootlimit}" ]' to compare if greater than or equal, just to cover any possible corner cases and guarantee we'll fallback. Related-to: TOR-3661 Signed-off-by: Eduardo Ferreira --- .../grub-ota-fallback/grub-ota-fallback/99_fallback_logic | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes-sota/grub-ota-fallback/grub-ota-fallback/99_fallback_logic b/recipes-sota/grub-ota-fallback/grub-ota-fallback/99_fallback_logic index 4af719cb..ec736a12 100644 --- a/recipes-sota/grub-ota-fallback/grub-ota-fallback/99_fallback_logic +++ b/recipes-sota/grub-ota-fallback/grub-ota-fallback/99_fallback_logic @@ -15,7 +15,7 @@ function inc_default { # Load all the variables needed load_env -if [ "${rollback}" == "0" -a "${upgrade_available}" = "1" ]; then +if [ "${rollback}" == "0" -a "${upgrade_available}" == "1" ]; then # Make sure to reset default whenever we already performed a rollback # and deployed a new image. This way we'll be able to boot this new image # and test it. If all fails we can still fallback. @@ -23,7 +23,7 @@ if [ "${rollback}" == "0" -a "${upgrade_available}" = "1" ]; then save_env default fi -if [ "${rollback}" == "1" -a "${upgrade_available}" = "1" ]; then +if [ "${rollback}" == "1" -a "${upgrade_available}" == "1" ]; then # Make sure to reset upgrade_available to avoid unnecessary wear # Note this also makes rollback permanent. aktualizr will reset rollback # when a new (hopefully better) update comes in. @@ -31,7 +31,7 @@ if [ "${rollback}" == "1" -a "${upgrade_available}" = "1" ]; then save_env upgrade_available fi -if [ "${bootcount}" == "${bootlimit}" ]; then +if [ "${bootcount}" -ge "${bootlimit}" ]; then # We've reached our retry limit, marking for OS rollback set rollback=1 save_env rollback