Blame SPECS/kmod-isci.spec

c530b6
%global pkg isci
c530b6
c530b6
%global kernel_version_min 4.18.0-80.el8
c530b6
c530b6
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
c530b6
# Otherwise the latest installed kernel-devel version later than
c530b6
# %%{kernel_version_min} will be used.
c530b6
c530b6
%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)
c530b6
c530b6
%if "%{kernel_version_latest}" != ""
c530b6
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
c530b6
%endif
c530b6
c530b6
%global _use_internal_dependency_generator 0
c530b6
%global __find_requires %{nil}
c530b6
%global __find_provides /usr/lib/rpm/find-provides
c530b6
c530b6
%global debug_package %{nil}
c530b6
c530b6
%global __spec_install_post \
c530b6
  %{?__debug_package:%{__debug_install_post}} \
c530b6
  %{__arch_install_post} \
c530b6
  %{__os_install_post} \
c530b6
  %{__mod_compress_install_post}
c530b6
c530b6
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
c530b6
c530b6
c530b6
Name:             kmod-%{pkg}
c530b6
Version:          5.0
e8daea
Release:          3%{?dist}
c530b6
Summary:          Intel(R) C600 Series Chipset SAS Controller (%{pkg}) driver
c530b6
c530b6
License:          GPLv2 and (BSD or GPLv2)
c530b6
URL:              https://www.kernel.org/
c530b6
c530b6
Source0:          %{pkg}-%{version}.tar.xz
c530b6
c530b6
ExclusiveArch:    x86_64
c530b6
c530b6
BuildRequires:    elfutils-libelf-devel
c530b6
BuildRequires:    gcc
c530b6
BuildRequires:    kmod
c530b6
BuildRequires:    make
c530b6
BuildRequires:    redhat-rpm-config
c530b6
BuildRequires:    xz
c530b6
c530b6
%{!?kernel_version:
c530b6
BuildRequires:    kernel-devel >= %{kernel_version_min}
c530b6
}
c530b6
c530b6
%{?kernel_version:
c530b6
BuildRequires:    kernel-devel = %{kernel_version}
c530b6
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
c530b6
c530b6
Requires:         kernel-core = %{kernel_version}
c530b6
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
c530b6
Requires:         kernel-modules = %{kernel_version}
c530b6
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
c530b6
c530b6
Provides:         installonlypkg(kernel-module)
c530b6
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
c530b6
}
c530b6
c530b6
Requires(post):   /usr/sbin/depmod
c530b6
Requires(postun): /usr/sbin/depmod
c530b6
c530b6
Requires(post):   /usr/bin/dracut
c530b6
Requires(postun): /usr/bin/dracut
c530b6
c530b6
c530b6
%description
c530b6
This driver supports the 6Gb/s SAS capabilities of the storage control unit
c530b6
found in the Intel(R) C600 series chipset. Supported devices:
c530b6
c530b6
- 0x8086:0x1D60
c530b6
- 0x8086:0x1D61
c530b6
- 0x8086:0x1D62
c530b6
- 0x8086:0x1D63
c530b6
- 0x8086:0x1D64
c530b6
- 0x8086:0x1D65
c530b6
- 0x8086:0x1D66
c530b6
- 0x8086:0x1D67
c530b6
- 0x8086:0x1D68
c530b6
- 0x8086:0x1D69
c530b6
- 0x8086:0x1D6A
c530b6
- 0x8086:0x1D6B
c530b6
c530b6
c530b6
%prep
c530b6
%autosetup -p1 -n %{pkg}-%{version}
c530b6
c530b6
c530b6
%build
c530b6
pushd src
c530b6
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
c530b6
popd
c530b6
c530b6
c530b6
%install
c530b6
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
c530b6
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
c530b6
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
c530b6
c530b6
# Make .ko objects temporarily executable for automatic stripping
c530b6
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
c530b6
c530b6
c530b6
%clean
c530b6
%{__rm} -rf %{buildroot}
c530b6
c530b6
c530b6
%post
c530b6
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
c530b6
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
c530b6
c530b6
c530b6
%preun
c530b6
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
c530b6
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
c530b6
c530b6
c530b6
%postun
c530b6
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
c530b6
then
c530b6
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
c530b6
    then
c530b6
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
c530b6
    fi
c530b6
c530b6
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
c530b6
    then
c530b6
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
c530b6
        then
c530b6
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
c530b6
            then
c530b6
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
c530b6
            else
c530b6
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
c530b6
            fi
c530b6
        fi
c530b6
    fi
c530b6
c530b6
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
c530b6
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
c530b6
fi
c530b6
c530b6
c530b6
%posttrans
c530b6
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
c530b6
then
c530b6
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
c530b6
    then
c530b6
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
c530b6
    fi
c530b6
c530b6
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
c530b6
    then
c530b6
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
c530b6
        then
c530b6
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
c530b6
            then
c530b6
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
c530b6
            else
c530b6
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
c530b6
            fi
c530b6
        fi
c530b6
    fi
c530b6
c530b6
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
c530b6
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
c530b6
fi
c530b6
c530b6
c530b6
%files
c530b6
%defattr(644,root,root,755)
c530b6
/lib/modules/%{kernel_version}.%{_arch}
c530b6
%license COPYING
c530b6
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
c530b6
c530b6
c530b6
%changelog
e8daea
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.0-3
e8daea
- Rebuild for 4.18.0-305.12.1.el8_4
e8daea
c530b6
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.0-2
c530b6
- Initial version