Blame SPECS/kmod-mvsas.spec

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