Blame SPECS/kmod-sata_sil24.spec

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