Blame SPECS/kmod-pata_jmicron.spec

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