Blame SPECS/kmod-sata_sis.spec

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