Skip to content

Instantly share code, notes, and snippets.

@tuldok89
Created July 17, 2023 10:17
Show Gist options
  • Save tuldok89/38731cc7dae0bc170137725f099920a1 to your computer and use it in GitHub Desktop.
Save tuldok89/38731cc7dae0bc170137725f099920a1 to your computer and use it in GitHub Desktop.
kernel-sbsign
#!/usr/bin/env bash
kernel="$1"
[[ -n "$kernel" ]] || exit 0
# use already installed kernel if it exists
[[ ! -f "$KERNELDESTINATION" ]] || kernel="$KERNELDESTINATION"
keypairs=(/etc/refind.d/keys/refind_local.key /etc/refind.d/keys/refind_local.crt)
for (( i=0; i<${#keypairs[@]}; i+=2 )); do
key="${keypairs[$i]}" cert="${keypairs[(( i + 1 ))]}"
if ! sbverify --cert "$cert" "$kernel" &>/dev/null; then
sbsign --key "$key" --cert "$cert" --output "$kernel" "$kernel"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment