Blame SPECS/kmod-sata_sil24.spec

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