Blame SPECS/kmod-sata_uli.spec

567377
%global pkg sata_uli
567377
Kmods SIG 8b696e
%global driver_version 4.18.0-80.el8
Kmods SIG 8b696e
Kmods SIG 8b696e
%global kernel_version 4.18.0-348.el8
567377
567377
%global _use_internal_dependency_generator 0
d2398e
%global __find_requires /usr/lib/rpm/redhat/find-requires
d2398e
%global __find_provides /usr/lib/rpm/redhat/find-provides
567377
567377
%global debug_package %{nil}
567377
567377
%global __spec_install_post \
567377
  %{?__debug_package:%{__debug_install_post}} \
567377
  %{__arch_install_post} \
567377
  %{__os_install_post} \
567377
  %{__mod_compress_install_post}
567377
567377
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
567377
567377
567377
Name:             kmod-%{pkg}
Kmods SIG 8b696e
Version:          4.18.0.80
Kmods SIG 8b696e
Release:          1%{?dist}
567377
Summary:          ULi Electronics SATA Controller (%{pkg}) driver
567377
7d14b4
License:          GPLv2 and GPLv2+
567377
URL:              https://www.kernel.org/
567377
Kmods SIG 8b696e
Source0:          %{pkg}-%{driver_version}.tar.xz
567377
567377
ExclusiveArch:    x86_64
567377
567377
BuildRequires:    elfutils-libelf-devel
567377
BuildRequires:    gcc
d2398e
BuildRequires:    kernel-rpm-macros
567377
BuildRequires:    kmod
567377
BuildRequires:    make
567377
BuildRequires:    redhat-rpm-config
567377
BuildRequires:    xz
567377
d2398e
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
567377
BuildRequires:    kernel-devel = %{kernel_version}
567377
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
567377
d2398e
Requires:         kernel >= %{kernel_version}
d2398e
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
d2398e
Requires:         kernel-modules >= %{kernel_version}
d2398e
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
567377
567377
Provides:         installonlypkg(kernel-module)
d2398e
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
567377
d2398e
Requires(post):   %{_sbindir}/depmod
d2398e
Requires(postun): %{_sbindir}/depmod
567377
d2398e
Requires(post):   %{_sbindir}/weak-modules
d2398e
Requires(postun): %{_sbindir}/weak-modules
567377
567377
567377
%description
567377
This driver supports ULi Electronics SATA controllers.
567377
567377
567377
%prep
Kmods SIG 8b696e
%autosetup -p1 -n %{pkg}-%{driver_version}
567377
567377
567377
%build
567377
pushd src
567377
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
567377
popd
567377
567377
567377
%install
567377
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata src/%{pkg}.ko
567377
%{__install} -d %{buildroot}/%{_sysconfdir}/dracut.conf.d/
567377
echo "add_drivers+=\" %{pkg} \"" > %{buildroot}/%{_sysconfdir}/dracut.conf.d/%{pkg}.conf
567377
567377
# Make .ko objects temporarily executable for automatic stripping
567377
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
567377
567377
567377
%clean
567377
%{__rm} -rf %{buildroot}
567377
567377
567377
%post
567377
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
d2398e
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/ata/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
567377
567377
567377
%preun
567377
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
d2398e
rpm -ql kmod-%{pkg}-%{?epoch:%{epoch}:}%{version}-%{release}.%{_arch} | grep '/lib/modules/%{kernel_version}.%{_arch}/.*\.ko\.xz$' >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
567377
567377
567377
%postun
d2398e
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
567377
then
d2398e
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
d2398e
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
567377
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
d2398e
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
567377
fi
567377
567377
d2398e
%pretrans -p <lua>
d2398e
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
d2398e
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
d2398e
d2398e
567377
%posttrans
d2398e
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
567377
then
d2398e
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
d2398e
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
567377
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
d2398e
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
567377
fi
567377
567377
567377
%files
567377
%defattr(644,root,root,755)
567377
/lib/modules/%{kernel_version}.%{_arch}
05b58d
%license LICENSES
567377
%config(noreplace) %{_sysconfdir}/dracut.conf.d/%{pkg}.conf
567377
567377
567377
%changelog
Kmods SIG 8b696e
* Wed Jan 12 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.80-1
Kmods SIG 8b696e
- Switch to EL kernel source and versioning
Kmods SIG 8b696e
- kABI tracking kmod package (kernel >= 4.18.0-348.el8)