2013-05-01 08:12:39 +02:00
|
|
|
%package -n %{-n*}-ueficert
|
|
|
|
Summary: UEFI Secure Boot Certificate For Package %{-n*}-kmp
|
|
|
|
Group: System/Kernel
|
|
|
|
%description -n %{-n*}-ueficert
|
|
|
|
This package contains the UEFI Secure Boot certificate used to sign
|
|
|
|
modules in the %{-n*}-kmp packages.
|
|
|
|
|
|
|
|
# The scriptlets are reused in kernel-binary.spec.in by a sed script that
|
|
|
|
# stops at the next line that starts with a percent sign
|
|
|
|
%post -n %{-n*}-ueficert
|
|
|
|
if ! command -v mokutil >/dev/null; then
|
|
|
|
exit 0
|
|
|
|
fi
|
2020-09-23 10:07:46 +02:00
|
|
|
# Only apply CA check on the kernel package certs (bsc#1173115)
|
|
|
|
if [ %{defined _suse_kernel_module_subpackage} = 0 ] && mokutil -h | grep -q "ca-check"; then
|
|
|
|
MOK_ARG="--ca-check"
|
|
|
|
else
|
|
|
|
MOK_ARG=""
|
|
|
|
fi
|
2013-05-01 08:12:39 +02:00
|
|
|
# XXX: Only call mokutil if UEFI and shim are used
|
|
|
|
for cert in @CERTS@; do
|
2021-09-13 10:04:04 +02:00
|
|
|
cert="/etc/uefi/certs/${cert}.crt"
|
2020-09-23 10:07:46 +02:00
|
|
|
if ! mokutil --import "$cert" --root-pw ${MOK_ARG}; then
|
2013-09-04 08:05:35 +02:00
|
|
|
echo "Failed to import $cert"
|
|
|
|
fi
|
2013-05-01 08:12:39 +02:00
|
|
|
done
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
%preun -n %{-n*}-ueficert
|
|
|
|
if ! command -v mokutil >/dev/null; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
for cert in @CERTS@; do
|
2021-09-13 10:04:04 +02:00
|
|
|
cert="/etc/uefi/certs/${cert}.crt"
|
2013-05-01 08:12:39 +02:00
|
|
|
ln "$cert" "$cert.delete"
|
|
|
|
done
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
%postun -n %{-n*}-ueficert
|
|
|
|
if ! command -v mokutil >/dev/null; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
for cert in @CERTS@; do
|
2021-09-13 10:04:04 +02:00
|
|
|
cert="/etc/uefi/certs/${cert}.crt"
|
2013-05-01 08:12:39 +02:00
|
|
|
if ! test -e "$cert"; then
|
2013-09-04 08:05:35 +02:00
|
|
|
if ! mokutil --delete "$cert.delete" --root-pw; then
|
|
|
|
echo "Failed to delete $cert"
|
|
|
|
fi
|
2013-05-01 08:12:39 +02:00
|
|
|
fi
|
|
|
|
rm "$cert.delete"
|
|
|
|
done
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
%files -n %{-n*}-ueficert
|
|
|
|
%defattr(-, root, root)
|
|
|
|
%dir /etc/uefi
|
|
|
|
/etc/uefi/certs
|