Blame SPECS/kmod-sata_sil.spec

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