Blame SPECS/kmod-vbox-guest-additions.spec

aac1c3
%global pkg vbox-guest-additions
aac1c3
aac1c3
%global driver_version 5.14.0-1.el9
aac1c3
Kmods SIG a15329
%global kernel_version 5.14.0-47.el9
aac1c3
aac1c3
%global debug_package %{nil}
aac1c3
aac1c3
%global __spec_install_post \
aac1c3
  %{?__debug_package:%{__debug_install_post}} \
aac1c3
  %{__arch_install_post} \
aac1c3
  %{__os_install_post} \
aac1c3
  %{__mod_compress_install_post}
aac1c3
aac1c3
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
aac1c3
aac1c3
aac1c3
Name:             kmod-%{pkg}
aac1c3
Version:          5.14.0.1
Kmods SIG a15329
Release:          2%{?dist}
aac1c3
Summary:          Virtual Box Guest Additions
aac1c3
aac1c3
License:          GPLv2 and (GPLv2 or CDDL-1.0) and MIT
aac1c3
URL:              https://www.kernel.org/
aac1c3
aac1c3
Source0:          %{pkg}-%{driver_version}.tar.xz
aac1c3
Patch9997:        9997-enable-vboxguest.patch
aac1c3
Patch9998:        9998-enable-vboxsf.patch
aac1c3
Patch9999:        9999-enable-vboxvideo.patch
aac1c3
aac1c3
ExclusiveArch:    x86_64
aac1c3
aac1c3
BuildRequires:    elfutils-libelf-devel
aac1c3
BuildRequires:    gcc
aac1c3
BuildRequires:    kernel-rpm-macros
aac1c3
BuildRequires:    kmod
aac1c3
BuildRequires:    make
aac1c3
BuildRequires:    redhat-rpm-config
aac1c3
BuildRequires:    xz
aac1c3
aac1c3
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
aac1c3
BuildRequires:    kernel-devel = %{kernel_version}
aac1c3
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
aac1c3
aac1c3
Requires:         kernel >= %{kernel_version}
aac1c3
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
aac1c3
Requires:         kernel-modules >= %{kernel_version}
aac1c3
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
aac1c3
aac1c3
Provides:         installonlypkg(kernel-module)
aac1c3
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
aac1c3
aac1c3
Requires(post):   %{_sbindir}/depmod
aac1c3
Requires(postun): %{_sbindir}/depmod
aac1c3
aac1c3
Requires(post):   %{_sbindir}/weak-modules
aac1c3
Requires(postun): %{_sbindir}/weak-modules
aac1c3
aac1c3
Supplements:      virtualbox-guest-additions
aac1c3
Recommends:       virtualbox-guest-additions
aac1c3
aac1c3
aac1c3
%description
aac1c3
This package provides the following drivers:
aac1c3
aac1c3
Driver (vboxguest) for the Virtual Box Guest PCI device used in Virtual Box
aac1c3
virtual machines. Enabling this driver will add support for Virtual Box Guest
aac1c3
integration features such as copy-and-paste, seamless mode and OpenGL
aac1c3
pass-through.
aac1c3
aac1c3
Driver (vboxfs) required to mount folders exported by the Virtual Box host to
aac1c3
be shared with guests.
aac1c3
aac1c3
KMS driver (vboxvideo) for the virtual Graphics Card used in Virtual Box
aac1c3
virtual machines.
aac1c3
aac1c3
aac1c3
%prep
aac1c3
%autosetup -p1 -n %{pkg}-%{driver_version}
aac1c3
aac1c3
aac1c3
%build
aac1c3
pushd src
aac1c3
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
aac1c3
popd
aac1c3
aac1c3
aac1c3
%install
aac1c3
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/virt/vboxguest src/vboxguest/vboxguest.ko
aac1c3
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/fs src/vboxsf/vboxsf.ko
aac1c3
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/gpu/drm/vboxvideo src/vboxvideo/vboxvideo.ko
aac1c3
aac1c3
# Make .ko objects temporarily executable for automatic stripping
aac1c3
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
aac1c3
aac1c3
aac1c3
%clean
aac1c3
%{__rm} -rf %{buildroot}
aac1c3
aac1c3
aac1c3
%post
aac1c3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
aac1c3
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/virt/vboxguest/vboxguest.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
aac1c3
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/fs/vboxsf/vboxsf.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
aac1c3
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/gpu/drm/vboxvideo/vboxvideo.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
aac1c3
aac1c3
aac1c3
%preun
aac1c3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
aac1c3
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
aac1c3
aac1c3
aac1c3
%postun
aac1c3
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
aac1c3
then
aac1c3
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
aac1c3
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
aac1c3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
aac1c3
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
aac1c3
fi
aac1c3
aac1c3
aac1c3
%pretrans -p <lua>
aac1c3
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
aac1c3
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
aac1c3
aac1c3
aac1c3
%posttrans
aac1c3
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
aac1c3
then
aac1c3
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
aac1c3
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
aac1c3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
aac1c3
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
aac1c3
fi
aac1c3
aac1c3
aac1c3
%files
aac1c3
%defattr(644,root,root,755)
aac1c3
/lib/modules/%{kernel_version}.%{_arch}
aac1c3
%license LICENSES
aac1c3
aac1c3
aac1c3
%changelog
Kmods SIG a15329
* Tue Jan 25 2022 Kmods SIG <sig-kmods@centosproject.org> - 5.14.0.1-2
Kmods SIG a15329
- Rebuild for 5.14.0-47.el9
Kmods SIG a15329
aac1c3
* Fri Jan 21 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.14.0.1-1
aac1c3
- Use EL kernel source and versioning
aac1c3
- kABI tracking kmod package (kernel >= 5.14.0-44.el9)