Blame SPECS/kmod-sata_nv.spec

a308b0
%global pkg sata_nv
a308b0
a308b0
%global kernel_version_min 4.18.0-80.el8
a308b0
a308b0
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
a308b0
# Otherwise the latest installed kernel-devel version later than
a308b0
# %%{kernel_version_min} will be used.
a308b0
a308b0
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1)
a308b0
a308b0
%if "%{kernel_version_latest}" != ""
a308b0
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
a308b0
%endif
a308b0
a308b0
%global _use_internal_dependency_generator 0
a308b0
%global __find_requires %{nil}
a308b0
%global __find_provides /usr/lib/rpm/find-provides
a308b0
a308b0
%global debug_package %{nil}
a308b0
a308b0
%global __spec_install_post \
a308b0
  %{?__debug_package:%{__debug_install_post}} \
a308b0
  %{__arch_install_post} \
a308b0
  %{__os_install_post} \
a308b0
  %{__mod_compress_install_post}
a308b0
a308b0
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
a308b0
a308b0
a308b0
Name:             kmod-%{pkg}
a308b0
Version:          5.4
ce6fd3
Release:          2%{?dist}
a308b0
Summary:          nVidia SATA Controller (%{pkg}) driver
a308b0
a308b0
License:          GPLv2
a308b0
URL:              https://www.kernel.org/
a308b0
a308b0
Source0:          %{pkg}-%{version}.tar.xz
a308b0
a308b0
ExclusiveArch:    x86_64
a308b0
a308b0
BuildRequires:    elfutils-libelf-devel
a308b0
BuildRequires:    gcc
a308b0
BuildRequires:    kmod
a308b0
BuildRequires:    make
a308b0
BuildRequires:    redhat-rpm-config
a308b0
BuildRequires:    xz
a308b0
a308b0
%{!?kernel_version:
a308b0
BuildRequires:    kernel-devel >= %{kernel_version_min}
a308b0
}
a308b0
a308b0
%{?kernel_version:
a308b0
BuildRequires:    kernel-devel = %{kernel_version}
a308b0
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
a308b0
a308b0
Requires:         kernel-core = %{kernel_version}
a308b0
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
a308b0
Requires:         kernel-modules = %{kernel_version}
a308b0
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
a308b0
a308b0
Provides:         installonlypkg(kernel-module)
a308b0
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
a308b0
}
a308b0
a308b0
Requires(post):   /usr/sbin/depmod
a308b0
Requires(postun): /usr/sbin/depmod
a308b0
a308b0
Requires(post):   /usr/bin/dracut
a308b0
Requires(postun): /usr/bin/dracut
a308b0
a308b0
a308b0
%description
a308b0
This driver supports nVidia SATA controllers.
a308b0
a308b0
a308b0
%prep
a308b0
%autosetup -p1 -n %{pkg}-%{version}
a308b0
a308b0
a308b0
%build
a308b0
pushd src
a308b0
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
a308b0
popd
a308b0
a308b0
a308b0
%install
a308b0
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata src/%{pkg}.ko
a308b0
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
a308b0
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
a308b0
a308b0
# Make .ko objects temporarily executable for automatic stripping
a308b0
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
a308b0
a308b0
a308b0
%clean
a308b0
%{__rm} -rf %{buildroot}
a308b0
a308b0
a308b0
%post
a308b0
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
a308b0
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
a308b0
a308b0
a308b0
%preun
a308b0
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
a308b0
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
a308b0
a308b0
a308b0
%postun
a308b0
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
a308b0
then
a308b0
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
a308b0
    then
a308b0
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
a308b0
    fi
a308b0
a308b0
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
a308b0
    then
a308b0
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
a308b0
        then
a308b0
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
a308b0
            then
a308b0
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
a308b0
            else
a308b0
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
a308b0
            fi
a308b0
        fi
a308b0
    fi
a308b0
a308b0
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
a308b0
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
a308b0
fi
a308b0
a308b0
a308b0
%posttrans
a308b0
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
a308b0
then
a308b0
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
a308b0
    then
a308b0
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
a308b0
    fi
a308b0
a308b0
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
a308b0
    then
a308b0
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
a308b0
        then
a308b0
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
a308b0
            then
a308b0
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
a308b0
            else
a308b0
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
a308b0
            fi
a308b0
        fi
a308b0
    fi
a308b0
a308b0
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
a308b0
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
a308b0
fi
a308b0
a308b0
a308b0
%files
a308b0
%defattr(644,root,root,755)
a308b0
/lib/modules/%{kernel_version}.%{_arch}
a308b0
%license COPYING
a308b0
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
a308b0
a308b0
a308b0
%changelog
ce6fd3
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.4-2
ce6fd3
- Rebuild for 4.18.0-326.el8
ce6fd3
a308b0
* Mon Aug  9 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.4-1
a308b0
- Initial version