Blame SPECS/kmod-wireguard.spec

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