Blame SPECS/kmod-mvsas.spec

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