dotfiles-arch/.root/etc/initcpio/post/uki-sbsign

16 lines
352 B
Text
Raw Normal View History

2024-05-15 13:53:10 +00:00
#!/usr/bin/env bash
uki="$3"
[[ -n "$uki" ]] || exit 0
keypairs=(/var/lib/sbctl/keys/db/db.key /var/lib/sbctl/keys/db/db.pem)
2024-05-15 13:53:10 +00:00
for (( i=0; i<${#keypairs[@]}; i+=2 )); do
key="${keypairs[$i]}"
cert="${keypairs[(( i + 1))]}"
if ! sbverify --cert "$cert" "$uki" &>/dev/null; then
sbsign --key "$key" --cert "$cert" --output "$uki" "$uki"
fi
done