Blame SPECS/kmod-sata_nv.spec

a308b0
%global pkg sata_nv
a308b0
82198f
%global kernel_version 4.18.0-338.el8
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
82198f
Release:          4%{?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
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)
35fd58
Provides:         kernel-modules = %{kernel_version}.%{_arch}
a308b0
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
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
82198f
* Mon Aug 30 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.4-4
82198f
- Set specific kernel version to use
82198f
- Add Provides kernel-modules
82198f
- Add .%{_arch} to kernel-modules provides version
82198f
- Rebuild for 4.18.0-338.el8
82198f
5a8854
* Thu Aug 19 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.4-3
5a8854
- Rebuild for 4.18.0-331.el8
5a8854
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