Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the mkinitcpio post hook to only sign the kernel/UKI which is currently being built instead of all the files in the sbctl database #285

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions contrib/mkinitcpio/sbctl
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
#!/usr/bin/bash
echo "Signing EFI binaries..."
/usr/bin/sbctl sign-all -g

KERENEL_FILE="$1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in the var name?

UKI_FILE="$3"

IMAGE_FILE="$KERENEL_FILE"
if [ -n "$KERNELDESTINATION" ] && [ -f "$KERNELDESTINATION" ]; then
IMAGE_FILE="$KERNELDESTINATION"
fi
if [ -n "$UKI_FILE" ]; then
IMAGE_FILE="$UKI_FILE"
fi

if [ -z "$IMAGE_FILE" ]; then
echo "No kernel or UKI found for signing"
exit 0
fi

echo "Signing $IMAGE_FILE"
sbctl sign -s "$IMAGE_FILE"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need -s here?

Copy link

@marmitar marmitar May 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this has already been merged, but I think the -s is right here. Initramfs files should always be saved to the database and resigned as soon as possible, when necessary.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

problem is they're never removed from the sbctl "database", so if you remove the uki, now the sbctl database is out-of-sync

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, sbctl will just display an error, but the exit code will still be zero. So you can just remove from the database file manually when you see the message. That's why the current behavior is ok IMHO.

Loading