kernel-livepatch-tools/kernel-livepatch-subpackage

49 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

%define _this_kmp_name %{-n*}-%(echo %2 | sed -r 'y/\./_/')
%package -n %_this_kmp_name
Release: %{-r*}
Summary: %summary
Group: %group
Supplements: packageand(%3:kernel-livepatch-tools)
Requires: coreutils grep
Requires: %3
Requires(post): kernel-livepatch-tools >= 1.2
Requires(postun): kernel-livepatch-tools >= 1.2
%description -n %_this_kmp_name
%(
for spec in {%_sourcedir,%_specdir}/%name.spec /dev/null; do
[ -e $spec ] && break
done
awk '
/^%%/ { in_desc = \
($0 ~ /^%%description[ \t]*$/ ||
$0 ~ /^%%description[ \t]+-n[ \t]*%name[ \t]*$/)
next }
in_desc { print }
' $spec
)
%pre -n %_this_kmp_name
nvr=%_this_kmp_name-%{version}-%{-r*}
/bin/bash -${-/e/} %{_libexecdir}/kernel-livepatch/rpm-helper check "$nvr" "%1" $1
%post -n %_this_kmp_name
nvr=%_this_kmp_name-%{version}-%{-r*}
/bin/bash -${-/e/} %{_libexecdir}/kernel-livepatch/rpm-helper install "$nvr" "%1" $1
%posttrans -n %_this_kmp_name
%{?regenerate_initrd_posttrans}
%postun -n %_this_kmp_name
nvr=%_this_kmp_name-%{version}-%{-r*}
/bin/bash -${-/e/} %{_libexecdir}/kernel-livepatch/rpm-helper remove "$nvr" "%1" $1
%files -n %_this_kmp_name
%defattr (-,root,root)
%if 0%{?suse_version} >= 1600
%dir /usr/lib/modules/%1
/usr/lib/modules/%1/livepatch
%else
%dir /lib/modules/%1
/lib/modules/%1/livepatch
%endif