Blame SPECS/kmod-exfat.spec

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