Skip to content

Commit 3a10a14

Browse files
committed
kernel.spec: add '-e' option to %preun for kernel-core and kernel-uki-virt
JIRA: https://issues.redhat.com/browse/RHEL-107668 Because kernel-install from systemd (see PR 37897) now takes a new argument '--entry-type type1|type2'. Only scriptlet %preun section needs to add. This is useful both kernel-core and kernel-uki-virt are installed for the same kernel version In this context, 'type1' refers to core, and 'type2' refers to uki. Resolve: RHEL-104228 Refer to systemd/systemd#37897 Signed-off-by: Xuemin Li <[email protected]> (cherry picked from commit bf6016e7a04a18da5b1886e07ab112c58619dc7d) Signed-off-by: Xuemin Li <[email protected]>
1 parent 052851f commit 3a10a14

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

redhat/kernel.spec.template

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3287,11 +3287,18 @@ touch %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{KVERREL}%{?-v:+%
32873287

32883288
#
32893289
# This macro defines a %%preun script for a kernel package.
3290-
# %%kernel_variant_preun [-v <subpackage>] [-u uki-suffix]
3290+
# %%kernel_variant_preun [-v <subpackage>] -u [uki-suffix] -e
3291+
# Add kernel-install's --entry-type=type1|type2|all option (if supported) to limit removal
3292+
# to a specific boot entry type.
32913293
#
3292-
%define kernel_variant_preun(v:u:) \
3294+
%define kernel_variant_preun(v:u:e) \
32933295
%{expand:%%preun %{?-v:%{-v*}-}%{!?-u*:core}%{?-u*:uki-%{-u*}}}\
3294-
/bin/kernel-install remove %{KVERREL}%{?-v:+%{-v*}} || exit $?\
3296+
entry_type=""\
3297+
%{-e: \
3298+
/bin/kernel-install --help|grep -q -- '--entry-type=' &&\
3299+
entry_type="--entry-type %{!?-u:type1}%{?-u:type2}" \
3300+
}\
3301+
/bin/kernel-install remove %{KVERREL}%{?-v:+%{-v*}} $entry_type || exit $?\
32953302
if [ -x %{_sbindir}/weak-modules ]\
32963303
then\
32973304
%{_sbindir}/weak-modules --remove-kernel %{KVERREL}%{?-v:+%{-v*}} || exit $?\
@@ -3300,10 +3307,10 @@ fi\
33003307

33013308
%if %{efiuki}
33023309
%kernel_variant_posttrans -u virt
3303-
%kernel_variant_preun -u virt
3310+
%kernel_variant_preun -u virt -e
33043311
%endif
33053312

3306-
%kernel_variant_preun
3313+
%kernel_variant_preun -e
33073314
%kernel_variant_post -r kernel-smp
33083315

33093316
%if %{with_pae}
@@ -3349,9 +3356,9 @@ fi\
33493356
%if %{with_debug}
33503357
%if %{efiuki}
33513358
%kernel_variant_posttrans -v debug -u virt
3352-
%kernel_variant_preun -v debug -u virt
3359+
%kernel_variant_preun -v debug -u virt -e
33533360
%endif
3354-
%kernel_variant_preun -v debug
3361+
%kernel_variant_preun -v debug -e
33553362
%kernel_variant_post -v debug
33563363
%endif
33573364

0 commit comments

Comments
 (0)