Blame SPECS/kmod-3w-sas.spec

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