Blame SPECS/kmod-exfat.spec

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