Blame SPECS/kmod-ecryptfs.spec

6521d1
%global pkg ecryptfs
6521d1
6521d1
%global kernel_version 4.18.0-348.el8
6521d1
6521d1
%global _use_internal_dependency_generator 0
6521d1
%global __find_requires /usr/lib/rpm/redhat/find-requires
6521d1
%global __find_provides /usr/lib/rpm/redhat/find-provides
6521d1
6521d1
%global debug_package %{nil}
6521d1
6521d1
%global __spec_install_post \
6521d1
  %{?__debug_package:%{__debug_install_post}} \
6521d1
  %{__arch_install_post} \
6521d1
  %{__os_install_post} \
6521d1
  %{__mod_compress_install_post}
6521d1
6521d1
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
6521d1
6521d1
6521d1
Name:             kmod-%{pkg}
6521d1
Version:          5.10
6521d1
Release:          1%{?dist}
6521d1
Summary:          Encrypted filesystem that operates on the VFS layer
6521d1
6521d1
License:          GPLv2
6521d1
URL:              https://www.kernel.org/
6521d1
6521d1
Source0:          %{pkg}-%{version}.tar.xz
6521d1
6521d1
ExclusiveArch:    x86_64 aarch64
6521d1
6521d1
BuildRequires:    elfutils-libelf-devel
6521d1
BuildRequires:    gcc
6521d1
BuildRequires:    kernel-rpm-macros
6521d1
BuildRequires:    kmod
6521d1
BuildRequires:    make
6521d1
BuildRequires:    redhat-rpm-config
6521d1
BuildRequires:    xz
6521d1
6521d1
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
6521d1
BuildRequires:    kernel-devel = %{kernel_version}
6521d1
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
6521d1
6521d1
Requires:         kernel >= %{kernel_version}
6521d1
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
6521d1
Requires:         kernel-modules >= %{kernel_version}
6521d1
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
6521d1
6521d1
Provides:         installonlypkg(kernel-module)
6521d1
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
6521d1
6521d1
Requires(post):   %{_sbindir}/depmod
6521d1
Requires(postun): %{_sbindir}/depmod
6521d1
6521d1
Requires(post):   %{_sbindir}/weak-modules
6521d1
Requires(postun): %{_sbindir}/weak-modules
6521d1
6521d1
Supplements:      ecryptfs-utils
6521d1
Recommends:       ecryptfs-utils
6521d1
6521d1
6521d1
%description
6521d1
This package provides the required kernel module (ecryptfs) to mount devices
6521d1
formatted with the Encrypted filesystem that operates on the VFS layer.
6521d1
6521d1
6521d1
%prep
6521d1
%autosetup -p1 -n %{pkg}-%{version}
6521d1
6521d1
6521d1
%build
6521d1
pushd src
6521d1
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
6521d1
popd
6521d1
6521d1
6521d1
%install
6521d1
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/fs src/%{pkg}.ko
6521d1
6521d1
# Make .ko objects temporarily executable for automatic stripping
6521d1
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
6521d1
6521d1
6521d1
%clean
6521d1
%{__rm} -rf %{buildroot}
6521d1
6521d1
6521d1
%post
6521d1
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
6521d1
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/fs/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
6521d1
6521d1
6521d1
%preun
6521d1
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
6521d1
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
6521d1
6521d1
6521d1
%postun
6521d1
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
6521d1
then
6521d1
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
6521d1
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
6521d1
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
6521d1
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
6521d1
fi
6521d1
6521d1
6521d1
%pretrans -p <lua>
6521d1
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
6521d1
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
6521d1
6521d1
6521d1
%posttrans
6521d1
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
6521d1
then
6521d1
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
6521d1
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
6521d1
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
6521d1
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
6521d1
fi
6521d1
6521d1
6521d1
%files
6521d1
%defattr(644,root,root,755)
6521d1
/lib/modules/%{kernel_version}.%{_arch}
6521d1
%license COPYING
6521d1
6521d1
6521d1
%changelog
536806
* Thu Jan 06 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.10-1
6521d1
- Initial kABI tracking kmod package (kernel >= 4.18.0-348.el8)