Blame SPECS/kmod-sata_sis.spec

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