Skip to content

Commit

Permalink
common: fix return in commit_apply-dbx HUP hook
Browse files Browse the repository at this point in the history
This code was moved from rollback-health into a hostapp-update commit
hook, where it now runs outside of a function.

Replace the invalid return statements with exits.

Change-type: patch
Signed-off-by: Joseph Kogut <[email protected]>
  • Loading branch information
jakogut committed Sep 12, 2024
1 parent a25a784 commit 0d7a490
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ CURRENT_DB_ESL="/resin-boot/balena-keys/db.esl"

if [ ! -d "${EFI_DIR}" ]; then
# Not an EFI system, nothing to do
return
exit
fi

SECUREBOOT_VAL=$(efivar -p -n "${SECUREBOOT_VAR}" | tail -n 1 | sed -e "${EFIVAR_RE}")
if [ "${SECUREBOOT_VAL}" -ne 1 ]; then
# Secure boot disabled, nothing to do
return
exit
fi

if [ ! -d "${PENDING_DBX_DIR}" ]; then
# Unexpected state - the directory should have been created by HUP
# With it missing, there is nothing we can do
echo "Rollback: Directory '${PENDING_DBX_DIR}' should exist but it does not"
return
exit 1
fi

echo "Rollback: Applying pending DBX updates to prevent formerly allowed OS versions to boot"
Expand Down

0 comments on commit 0d7a490

Please sign in to comment.