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

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