Blame SPECS/kmod-ntfs3.spec

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