Blame SPECS/kmod-sata_via.spec

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