Blame SPECS/kmod-wireguard.spec

39a588
%global pkg wireguard
39a588
f25072
%global kernel_version 4.18.0-348.el8
39a588
39a588
%global _use_internal_dependency_generator 0
7f83a8
%global __find_requires /usr/lib/rpm/redhat/find-requires
7f83a8
%global __find_provides /usr/lib/rpm/redhat/find-provides
39a588
39a588
%global debug_package %{nil}
39a588
39a588
%global __spec_install_post \
39a588
  %{?__debug_package:%{__debug_install_post}} \
39a588
  %{__arch_install_post} \
39a588
  %{__os_install_post} \
39a588
  %{__mod_compress_install_post}
39a588
39a588
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
39a588
39a588
39a588
Name:             kmod-%{pkg}
39a588
Version:          1.0.20210606
f25072
Release:          7%{?dist}
39a588
Summary:          Fast, modern, secure VPN tunnel
39a588
39a588
License:          GPLv2
39a588
URL:              https://www.wireguard.com/
39a588
39a588
Source0:          https://git.zx2c4.com/%{pkg}-linux-compat/snapshot/%{pkg}-linux-compat-%{version}.tar.xz
39a588
f25072
Patch1:           0001-compat-account-for-latest-c8s-backports.patch
f25072
39a588
ExclusiveArch:    x86_64 aarch64
39a588
39a588
BuildRequires:    elfutils-libelf-devel
39a588
BuildRequires:    gcc
7f83a8
BuildRequires:    kernel-rpm-macros
39a588
BuildRequires:    kmod
39a588
BuildRequires:    make
39a588
BuildRequires:    redhat-rpm-config
39a588
BuildRequires:    xz
39a588
7f83a8
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
39a588
BuildRequires:    kernel-devel = %{kernel_version}
39a588
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
39a588
7f83a8
Requires:         kernel >= %{kernel_version}
7f83a8
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
7f83a8
Requires:         kernel-modules >= %{kernel_version}
7f83a8
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
39a588
39a588
Provides:         installonlypkg(kernel-module)
7f83a8
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
39a588
7f83a8
Requires(post):   %{_sbindir}/depmod
7f83a8
Requires(postun): %{_sbindir}/depmod
39a588
7f83a8
Requires(post):   %{_sbindir}/weak-modules
7f83a8
Requires(postun): %{_sbindir}/weak-modules
39a588
39a588
Supplements:      wireguard-tools
39a588
Recommends:       wireguard-tools
39a588
39a588
39a588
%description
39a588
WireGuard is an extremely simple yet fast and modern VPN that utilizes
39a588
state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more
39a588
useful than IPsec, while avoiding the massive headache. It intends to be
39a588
considerably more performant than OpenVPN. WireGuard is designed as a general
39a588
purpose VPN for running on embedded interfaces and super computers alike, fit
39a588
for many different circumstances.
39a588
39a588
39a588
%prep
39a588
%autosetup -p1 -n %{pkg}-linux-compat-%{version}
39a588
39a588
39a588
%build
39a588
pushd src
39a588
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
39a588
popd
39a588
39a588
39a588
%install
39a588
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/%{pkg} src/%{pkg}.ko
39a588
39a588
# Make .ko objects temporarily executable for automatic stripping
39a588
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
39a588
39a588
39a588
%clean
39a588
%{__rm} -rf %{buildroot}
39a588
39a588
39a588
%post
39a588
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
7f83a8
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/%{pkg}/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
39a588
39a588
39a588
%preun
39a588
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
7f83a8
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
39a588
39a588
39a588
%postun
7f83a8
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
39a588
then
7f83a8
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
7f83a8
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
39a588
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
7f83a8
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
39a588
fi
39a588
39a588
7f83a8
%pretrans -p <lua>
7f83a8
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
7f83a8
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
7f83a8
7f83a8
39a588
%posttrans
7f83a8
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
39a588
then
7f83a8
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
7f83a8
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
39a588
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
7f83a8
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
39a588
fi
39a588
39a588
39a588
%files
39a588
%defattr(644,root,root,755)
39a588
/lib/modules/%{kernel_version}.%{_arch}
39a588
%license COPYING
39a588
%doc README.md
39a588
39a588
39a588
%changelog
f25072
* Tue Nov 09 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-7
f25072
- Rebuild for 4.18.0-348.el8
f25072
7f83a8
* Wed Sep 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-6
7f83a8
- Convert to kABI tracking kmod package (kernel >= 4.18.0-305.7.1.el8_4)