Blame SPECS/kmod-exfat.spec

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