Blame SPECS/kmod-sata_nv.spec

6be223
%global pkg sata_nv
6be223
45a72c
%global kernel_version 4.18.0-305.12.1.el8_4
6be223
6be223
%global _use_internal_dependency_generator 0
6be223
%global __find_requires %{nil}
6be223
%global __find_provides /usr/lib/rpm/find-provides
6be223
6be223
%global debug_package %{nil}
6be223
6be223
%global __spec_install_post \
6be223
  %{?__debug_package:%{__debug_install_post}} \
6be223
  %{__arch_install_post} \
6be223
  %{__os_install_post} \
6be223
  %{__mod_compress_install_post}
6be223
6be223
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
6be223
6be223
6be223
Name:             kmod-%{pkg}
6be223
Version:          5.4
d683c5
Release:          2%{?dist}
6be223
Summary:          nVidia SATA Controller (%{pkg}) driver
6be223
6be223
License:          GPLv2
6be223
URL:              https://www.kernel.org/
6be223
6be223
Source0:          %{pkg}-%{version}.tar.xz
6be223
6be223
ExclusiveArch:    x86_64
6be223
6be223
BuildRequires:    elfutils-libelf-devel
6be223
BuildRequires:    gcc
6be223
BuildRequires:    kmod
6be223
BuildRequires:    make
6be223
BuildRequires:    redhat-rpm-config
6be223
BuildRequires:    xz
6be223
6be223
BuildRequires:    kernel-devel = %{kernel_version}
6be223
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
6be223
6be223
Requires:         kernel-core = %{kernel_version}
6be223
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
6be223
Requires:         kernel-modules = %{kernel_version}
6be223
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
6be223
6be223
Provides:         installonlypkg(kernel-module)
bfc643
Provides:         kernel-modules = %{kernel_version}
6be223
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
6be223
6be223
Requires(post):   /usr/sbin/depmod
6be223
Requires(postun): /usr/sbin/depmod
6be223
6be223
Requires(post):   /usr/bin/dracut
6be223
Requires(postun): /usr/bin/dracut
6be223
6be223
6be223
%description
6be223
This driver supports nVidia SATA controllers.
6be223
6be223
6be223
%prep
6be223
%autosetup -p1 -n %{pkg}-%{version}
6be223
6be223
6be223
%build
6be223
pushd src
6be223
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
6be223
popd
6be223
6be223
6be223
%install
6be223
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata src/%{pkg}.ko
6be223
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
6be223
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
6be223
6be223
# Make .ko objects temporarily executable for automatic stripping
6be223
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
6be223
6be223
6be223
%clean
6be223
%{__rm} -rf %{buildroot}
6be223
6be223
6be223
%post
6be223
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
6be223
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
6be223
6be223
6be223
%preun
6be223
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
6be223
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
6be223
6be223
6be223
%postun
6be223
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
6be223
then
6be223
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
6be223
    then
6be223
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
6be223
    fi
6be223
6be223
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
6be223
    then
6be223
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
6be223
        then
6be223
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
6be223
            then
6be223
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
6be223
            else
6be223
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
6be223
            fi
6be223
        fi
6be223
    fi
6be223
6be223
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
6be223
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
6be223
fi
6be223
6be223
6be223
%posttrans
6be223
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
6be223
then
6be223
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
6be223
    then
6be223
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
6be223
    fi
6be223
6be223
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
6be223
    then
6be223
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
6be223
        then
6be223
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
6be223
            then
6be223
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
6be223
            else
6be223
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
6be223
            fi
6be223
        fi
6be223
    fi
6be223
6be223
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
6be223
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
6be223
fi
6be223
6be223
6be223
%files
6be223
%defattr(644,root,root,755)
6be223
/lib/modules/%{kernel_version}.%{_arch}
6be223
%license COPYING
6be223
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
6be223
6be223
6be223
%changelog
d683c5
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.4-2
d683c5
- Rebuild for 4.18.0-305.12.1.el8_4
d683c5
6be223
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.4-1
6be223
- Initial version