Blame SPECS/kmod-3w-9xxx.spec

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