Skip to content

Commit

Permalink
grub-ota-fallback: fix some issues on grub fallback logic script
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
EdTheBearded committed Jan 9, 2025
1 parent 53a4eb8 commit 5b26b79
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ 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.
set default=0
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.
set upgrade_available=0
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
Expand Down

0 comments on commit 5b26b79

Please sign in to comment.