File kgraft-module-subpackage of Package kgraft

%define _this_kmp_name %{-n*}-%(echo %2 | sed -r 'y/\./_/')-%1
%package -n %_this_kmp_name
Release: %{-r*}
Summary: %summary
Group: %group
Supplements: packageand(kernel-%1-%2:kgraft)
Requires: coreutils grep
Requires: kernel-%1 = %2
Requires(post): kgraft
Requires(postun): kgraft
%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/} /usr/lib/kgraft/kgraft-rpm-helper check "$nvr" $1

%post -n %_this_kmp_name
nvr=%_this_kmp_name-%{version}-%{-r*}
/bin/bash -${-/e/} /usr/lib/kgraft/kgraft-rpm-helper install "$nvr" $1

%posttrans -n %_this_kmp_name
%{?regenerate_initrd_posttrans}

%postun -n %_this_kmp_name
nvr=%_this_kmp_name-%{version}-%{-r*}
/bin/bash -${-/e/} /usr/lib/kgraft/kgraft-rpm-helper remove "$nvr" $1

%files -n %_this_kmp_name
%defattr (-,root,root)
%dir /lib/modules/%2-%1
/lib/modules/%2-%1/kgraft
openSUSE Build Service is sponsored by