Blame SPECS/kmod-exfat.spec

c00b0e
%global pkg exfat
c00b0e
c00b0e
%global kernel_version 4.18.0-305.el8
c00b0e
c00b0e
%global _use_internal_dependency_generator 0
c00b0e
%global __find_requires %{nil}
c00b0e
%global __find_provides /usr/lib/rpm/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
c00b0e
Release:          1%{?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
c00b0e
BuildRequires:    kmod
c00b0e
BuildRequires:    make
c00b0e
BuildRequires:    redhat-rpm-config
c00b0e
BuildRequires:    xz
c00b0e
c00b0e
BuildRequires:    kernel-devel = %{kernel_version}
c00b0e
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
c00b0e
c00b0e
Requires:         kernel-core = %{kernel_version}
c00b0e
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
c00b0e
Requires:         kernel-modules = %{kernel_version}
c00b0e
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
c00b0e
c00b0e
Provides:         installonlypkg(kernel-module)
c00b0e
Provides:         kernel-modules = %{kernel_version}.%{_arch}
c00b0e
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
c00b0e
c00b0e
Requires(post):   /usr/sbin/depmod
c00b0e
Requires(postun): /usr/sbin/depmod
c00b0e
c00b0e
Requires(post):   /usr/bin/dracut
c00b0e
Requires(postun): /usr/bin/dracut
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
c00b0e
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
c00b0e
c00b0e
c00b0e
%preun
c00b0e
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
c00b0e
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
c00b0e
c00b0e
c00b0e
%postun
c00b0e
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
c00b0e
then
c00b0e
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
c00b0e
    then
c00b0e
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
c00b0e
    fi
c00b0e
c00b0e
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
c00b0e
    then
c00b0e
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
c00b0e
        then
c00b0e
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
c00b0e
            then
c00b0e
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
c00b0e
            else
c00b0e
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
c00b0e
            fi
c00b0e
        fi
c00b0e
    fi
c00b0e
c00b0e
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
c00b0e
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
c00b0e
fi
c00b0e
c00b0e
c00b0e
%posttrans
c00b0e
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
c00b0e
then
c00b0e
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
c00b0e
    then
c00b0e
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
c00b0e
    fi
c00b0e
c00b0e
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
c00b0e
    then
c00b0e
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
c00b0e
        then
c00b0e
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
c00b0e
            then
c00b0e
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
c00b0e
            else
c00b0e
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
c00b0e
            fi
c00b0e
        fi
c00b0e
    fi
c00b0e
c00b0e
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
c00b0e
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
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
c00b0e
* Mon Aug 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.14-1
c00b0e
- Initial version