Blame SPECS/kmod-3w-sas.spec

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