Blame SPECS/kmod-arcmsr.spec

e38a59
%global pkg arcmsr
e38a59
e38a59
%global kernel_version_min 4.18.0-305.el8
e38a59
e38a59
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
e38a59
# Otherwise the latest installed kernel-devel version later than
e38a59
# %%{kernel_version_min} will be used.
e38a59
e38a59
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1)
e38a59
e38a59
%if "%{kernel_version_latest}" != ""
e38a59
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
e38a59
%endif
e38a59
e38a59
%global _use_internal_dependency_generator 0
e38a59
%global __find_requires %{nil}
e38a59
%global __find_provides /usr/lib/rpm/find-provides
e38a59
e38a59
%global debug_package %{nil}
e38a59
e38a59
%global __spec_install_post \
e38a59
  %{?__debug_package:%{__debug_install_post}} \
e38a59
  %{__arch_install_post} \
e38a59
  %{__os_install_post} \
e38a59
  %{__mod_compress_install_post}
e38a59
e38a59
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
e38a59
e38a59
e38a59
Name:             kmod-%{pkg}
e38a59
Version:          4.19
1f2776
Release:          2%{?dist}
e38a59
Summary:          ARECA ARC11xx/12xx/13xx/16xx SATA/SAS RAID Controller (%{pkg}) driver
e38a59
e38a59
License:          GPLv2
e38a59
URL:              https://www.kernel.org/
e38a59
e38a59
Source0:          %{pkg}-%{version}.tar.xz
e38a59
e38a59
ExclusiveArch:    x86_64 aarch64
e38a59
e38a59
BuildRequires:    elfutils-libelf-devel
e38a59
BuildRequires:    gcc
e38a59
BuildRequires:    kmod
e38a59
BuildRequires:    make
e38a59
BuildRequires:    redhat-rpm-config
e38a59
BuildRequires:    xz
e38a59
e38a59
%{!?kernel_version:
e38a59
BuildRequires:    kernel-devel >= %{kernel_version_min}
e38a59
}
e38a59
e38a59
%{?kernel_version:
e38a59
BuildRequires:    kernel-devel = %{kernel_version}
e38a59
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
e38a59
e38a59
Requires:         kernel-core = %{kernel_version}
e38a59
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
e38a59
Requires:         kernel-modules = %{kernel_version}
e38a59
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
e38a59
e38a59
Provides:         installonlypkg(kernel-module)
e38a59
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
e38a59
}
e38a59
e38a59
Requires(post):   /usr/sbin/depmod
e38a59
Requires(postun): /usr/sbin/depmod
e38a59
e38a59
Requires(post):   /usr/bin/dracut
e38a59
Requires(postun): /usr/bin/dracut
e38a59
e38a59
e38a59
%description
e38a59
This driver supports ARECA's SATA/SAS RAID controller cards.
e38a59
e38a59
e38a59
%prep
e38a59
%autosetup -p1 -n %{pkg}-%{version}
e38a59
e38a59
e38a59
%build
e38a59
pushd src
e38a59
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
e38a59
popd
e38a59
e38a59
e38a59
%install
e38a59
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
e38a59
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
e38a59
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
e38a59
e38a59
# Make .ko objects temporarily executable for automatic stripping
e38a59
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
e38a59
e38a59
e38a59
%clean
e38a59
%{__rm} -rf %{buildroot}
e38a59
e38a59
e38a59
%post
e38a59
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
e38a59
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
e38a59
e38a59
e38a59
%preun
e38a59
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
e38a59
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
e38a59
e38a59
e38a59
%postun
e38a59
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
e38a59
then
e38a59
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
e38a59
    then
e38a59
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
e38a59
    fi
e38a59
e38a59
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
e38a59
    then
e38a59
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
e38a59
        then
e38a59
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
e38a59
            then
e38a59
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
e38a59
            else
e38a59
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
e38a59
            fi
e38a59
        fi
e38a59
    fi
e38a59
e38a59
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
e38a59
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
e38a59
fi
e38a59
e38a59
e38a59
%posttrans
e38a59
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
e38a59
then
e38a59
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
e38a59
    then
e38a59
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
e38a59
    fi
e38a59
e38a59
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
e38a59
    then
e38a59
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
e38a59
        then
e38a59
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
e38a59
            then
e38a59
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
e38a59
            else
e38a59
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
e38a59
            fi
e38a59
        fi
e38a59
    fi
e38a59
e38a59
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
e38a59
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
e38a59
fi
e38a59
e38a59
e38a59
%files
e38a59
%defattr(644,root,root,755)
e38a59
/lib/modules/%{kernel_version}.%{_arch}
e38a59
%license COPYING
e38a59
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
e38a59
e38a59
e38a59
%changelog
1f2776
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-2
1f2776
- Rebuild for 4.18.0-305.12.1.el8_4
1f2776
e38a59
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.19-1
e38a59
- Initial version