2013-05-01 08:12:39 +02:00
|
|
|
%package -n %{-n*}-kmp-%1
|
2011-10-05 07:01:45 +02:00
|
|
|
%define _this_kmp_version %{-v*}_k%(echo %2 | sed -r 'y/-/_/; s/^(2\.6\.[0-9]+)_/\\1.0_/; # use 2.6.x.0 for mainline kernels')
|
|
|
|
Version: %_this_kmp_version
|
|
|
|
Release: %{-r*}
|
|
|
|
%(
|
|
|
|
for spec in {%_sourcedir,%_specdir}/%name.spec /dev/null; do
|
|
|
|
[ -e $spec ] && break
|
|
|
|
done
|
|
|
|
awk '
|
|
|
|
BEGIN { tags["summary"] = "Summary: %summary"
|
|
|
|
tags["group"] = "Group: %group" }
|
|
|
|
/^%%/ { in_pkg_header = \
|
|
|
|
($0 ~ /^%%package[ \t]+KMP[ \t]*$/ ||
|
|
|
|
$0 ~ /^%%package[ \t]+-n[ \t]*%name-KMP[ \t]*$/)
|
|
|
|
next }
|
|
|
|
in_pkg_header && /^(Summary|Group):[ \t]*/ \
|
|
|
|
{ tag = tolower($1) ; sub(/:$/, "", tag)
|
|
|
|
tags[tag] = $0 }
|
|
|
|
END { print tags["summary"]
|
|
|
|
print tags["group"] }
|
|
|
|
' $spec
|
|
|
|
)
|
2013-05-01 08:12:39 +02:00
|
|
|
Provides: %{-n*}-kmp = %_this_kmp_version
|
|
|
|
Provides: %{-n*}-kmp = %{-v*}
|
2011-10-05 07:01:45 +02:00
|
|
|
Provides: multiversion(kernel)
|
|
|
|
Requires: coreutils grep
|
2013-05-01 08:12:39 +02:00
|
|
|
%{-c:Requires: %{-n*}-ueficert}
|
2011-10-05 07:01:45 +02:00
|
|
|
Enhances: kernel-%1
|
2013-10-03 08:02:42 +02:00
|
|
|
%if %1 == "default"
|
2014-06-11 08:02:23 +02:00
|
|
|
Obsoletes: %{-n*}-trace
|
|
|
|
%ifarch %ix86
|
2013-10-03 08:02:42 +02:00
|
|
|
Obsoletes: %{-n*}-vmi
|
|
|
|
%endif
|
2015-10-01 08:04:51 +02:00
|
|
|
%ifarch x86_64
|
|
|
|
Obsoletes: %{-n*}-desktop
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
%if %1 == "pae"
|
|
|
|
Obsoletes: %{-n*}-desktop
|
2013-10-03 08:02:42 +02:00
|
|
|
%endif
|
2011-10-05 07:01:45 +02:00
|
|
|
AutoReqProv: on
|
|
|
|
%{-p:%{expand:%(cd %_sourcedir; cat %{-p*})}}
|
2013-05-01 08:12:39 +02:00
|
|
|
%description -n %{-n*}-kmp-%1
|
2011-10-05 07:01:45 +02:00
|
|
|
%(
|
|
|
|
for spec in {%_sourcedir,%_specdir}/%name.spec /dev/null; do
|
|
|
|
[ -e $spec ] && break
|
|
|
|
done
|
|
|
|
awk '
|
|
|
|
/^%%/ { in_desc = \
|
|
|
|
($0 ~ /^%%description[ \t]+KMP[ \t]*$/ ||
|
|
|
|
$0 ~ /^%%description[ \t]+-n[ \t]*%name-KMP[ \t]*$/)
|
|
|
|
next }
|
|
|
|
in_desc { print; good = 1 }
|
|
|
|
END { exit(! good) }
|
|
|
|
' $spec || \
|
|
|
|
awk '
|
|
|
|
/^%%/ { in_desc = \
|
|
|
|
($0 ~ /^%%description[ \t]*$/ ||
|
|
|
|
$0 ~ /^%%description[ \t]+-n[ \t]*%name[ \t]*$/)
|
|
|
|
next }
|
|
|
|
in_desc { print; good = 1 }
|
|
|
|
END { exit(! good) }
|
|
|
|
' $spec
|
|
|
|
)
|
2013-05-01 08:12:39 +02:00
|
|
|
%post -n %{-n*}-kmp-%1
|
|
|
|
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
|
2011-10-05 07:01:45 +02:00
|
|
|
wm2=/usr/lib/module-init-tools/weak-modules2
|
|
|
|
if [ -x $wm2 ]; then
|
2014-04-15 08:02:51 +02:00
|
|
|
%{-b:KMP_NEEDS_MKINITRD=1} INITRD_IN_POSTTRANS=1 /bin/bash -${-/e/} $wm2 --add-kmp $nvr
|
2011-10-05 07:01:45 +02:00
|
|
|
fi
|
2014-04-15 08:02:51 +02:00
|
|
|
%posttrans -n %{-n*}-kmp-%1
|
|
|
|
%{?regenerate_initrd_posttrans}
|
2013-05-01 08:12:39 +02:00
|
|
|
%preun -n %{-n*}-kmp-%1
|
|
|
|
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
|
2011-10-05 07:01:45 +02:00
|
|
|
rpm -ql $nvr | sed -n '/\.ko$/p' > /var/run/rpm-$nvr-modules
|
2013-05-01 08:12:39 +02:00
|
|
|
%postun -n %{-n*}-kmp-%1
|
|
|
|
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
|
2011-10-05 07:01:45 +02:00
|
|
|
modules=( $(cat /var/run/rpm-$nvr-modules) )
|
|
|
|
rm -f /var/run/rpm-$nvr-modules
|
|
|
|
if [ ${#modules[*]} = 0 ]; then
|
|
|
|
echo "WARNING: $nvr does not contain any kernel modules" >&2
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
wm2=/usr/lib/module-init-tools/weak-modules2
|
|
|
|
if [ -x $wm2 ]; then
|
|
|
|
printf '%s\n' "${modules[@]}" | /bin/bash -${-/e/} $wm2 --remove-kmp $nvr
|
|
|
|
fi
|
2013-05-01 08:12:39 +02:00
|
|
|
%files -n %{-n*}-kmp-%1
|
2011-10-05 07:01:45 +02:00
|
|
|
%{-f:%{expand:%(cd %_sourcedir; cat %{-f*})}}
|
|
|
|
%{!-f:%defattr (-,root,root)}
|
|
|
|
%{!-f:/lib/modules/%2-%1}
|