Blame SPECS/kmod-pata_sis.spec

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