Blame SPECS/kmod-pata_via.spec

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