Blame SPECS/kmod-xt_time.spec

ba0f8e
%global pkg xt_time
ba0f8e
45c810
%global kernel_version 4.18.0-315.el8
ba0f8e
ba0f8e
%global _use_internal_dependency_generator 0
45c810
%global __find_requires /usr/lib/rpm/redhat/find-requires
45c810
%global __find_provides /usr/lib/rpm/redhat/find-provides
ba0f8e
ba0f8e
%global debug_package %{nil}
ba0f8e
ba0f8e
%global __spec_install_post \
ba0f8e
  %{?__debug_package:%{__debug_install_post}} \
ba0f8e
  %{__arch_install_post} \
ba0f8e
  %{__os_install_post} \
ba0f8e
  %{__mod_compress_install_post}
ba0f8e
ba0f8e
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
ba0f8e
ba0f8e
ba0f8e
Name:             kmod-%{pkg}
ba0f8e
Version:          5.9
45c810
Release:          5%{?dist}
ba0f8e
Summary:          Time match support for Netfilter (xt_time)
ba0f8e
ba0f8e
License:          GPLv2
ba0f8e
URL:              https://www.kernel.org/
ba0f8e
ba0f8e
Source0:          %{pkg}-%{version}.tar.xz
ba0f8e
ba0f8e
ExclusiveArch:    x86_64 aarch64
ba0f8e
ba0f8e
BuildRequires:    elfutils-libelf-devel
ba0f8e
BuildRequires:    gcc
45c810
BuildRequires:    kernel-rpm-macros
ba0f8e
BuildRequires:    kmod
ba0f8e
BuildRequires:    make
ba0f8e
BuildRequires:    redhat-rpm-config
ba0f8e
BuildRequires:    xz
ba0f8e
45c810
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
ba0f8e
BuildRequires:    kernel-devel = %{kernel_version}
ba0f8e
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
ba0f8e
45c810
Requires:         kernel >= %{kernel_version}
45c810
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
45c810
Requires:         kernel-modules >= %{kernel_version}
45c810
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
ba0f8e
ba0f8e
Provides:         installonlypkg(kernel-module)
45c810
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
ba0f8e
45c810
Requires(post):   %{_sbindir}/depmod
45c810
Requires(postun): %{_sbindir}/depmod
ba0f8e
45c810
Requires(post):   %{_sbindir}/weak-modules
45c810
Requires(postun): %{_sbindir}/weak-modules
ba0f8e
ba0f8e
ba0f8e
%description
ba0f8e
This package provides the "time" match module for the Network packet filtering
ba0f8e
framework (Netfilter). It allows you to match based on the packet arrival or
ba0f8e
departure time.
ba0f8e
ba0f8e
ba0f8e
%prep
ba0f8e
%autosetup -p1 -n %{pkg}-%{version}
ba0f8e
ba0f8e
ba0f8e
%build
ba0f8e
pushd src
ba0f8e
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
ba0f8e
popd
ba0f8e
ba0f8e
ba0f8e
%install
ba0f8e
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/net/netfilter src/%{pkg}.ko
ba0f8e
ba0f8e
# Make .ko objects temporarily executable for automatic stripping
ba0f8e
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
ba0f8e
ba0f8e
ba0f8e
%clean
ba0f8e
%{__rm} -rf %{buildroot}
ba0f8e
ba0f8e
ba0f8e
%post
ba0f8e
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
45c810
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/net/netfilter/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
ba0f8e
ba0f8e
ba0f8e
%preun
ba0f8e
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
45c810
rpm -ql kmod-%{pkg}-%{?epoch:%{epoch}:}%{version}-%{release}.%{_arch} | grep '/lib/modules/%{kernel_version}.%{_arch}/.*\.ko\.xz$' >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
ba0f8e
ba0f8e
ba0f8e
%postun
45c810
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
ba0f8e
then
45c810
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
45c810
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
ba0f8e
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
45c810
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
ba0f8e
fi
ba0f8e
ba0f8e
45c810
%pretrans -p <lua>
45c810
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
45c810
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
45c810
45c810
ba0f8e
%posttrans
45c810
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
ba0f8e
then
45c810
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
45c810
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
ba0f8e
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
45c810
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
ba0f8e
fi
ba0f8e
ba0f8e
ba0f8e
%files
ba0f8e
%defattr(644,root,root,755)
ba0f8e
/lib/modules/%{kernel_version}.%{_arch}
ba0f8e
%license COPYING
ba0f8e
ba0f8e
ba0f8e
%changelog
45c810
* Tue Sep 28 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.9-5
45c810
- Convert to kABI tracking kmod package (kernel >= 4.18.0-315.el8)