Blame SPECS/kmod-wireguard.spec

812836
%global pkg wireguard
812836
5bf30b
%global kernel_version 4.18.0-338.el8
812836
fafb58
%global _use_internal_dependency_generator 0
05d26b
%global __find_requires %{nil}
e0be9c
%global __find_provides /usr/lib/rpm/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}
52cf4e
Version:          1.0.20210606
5bf30b
Release:          4%{?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
52cf4e
Patch1:           0001-compat-account-for-latest-c8s-backports.patch
52cf4e
fafb58
ExclusiveArch:    x86_64 aarch64
fafb58
fafb58
BuildRequires:    elfutils-libelf-devel
812836
BuildRequires:    gcc
fafb58
BuildRequires:    kmod
812836
BuildRequires:    make
fafb58
BuildRequires:    redhat-rpm-config
fafb58
BuildRequires:    xz
fafb58
f037f6
BuildRequires:    kernel-devel = %{kernel_version}
4fd350
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
f037f6
ee700d
Requires:         kernel-core = %{kernel_version}
4fd350
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
6bfada
Requires:         kernel-modules = %{kernel_version}
4fd350
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
f037f6
6f7084
Provides:         installonlypkg(kernel-module)
419aae
Provides:         kernel-modules = %{kernel_version}.%{_arch}
627a9e
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
f037f6
fafb58
Requires(post):   /usr/sbin/depmod
fafb58
Requires(postun): /usr/sbin/depmod
fafb58
65288d
Requires(post):   /usr/bin/dracut
65288d
Requires(postun): /usr/bin/dracut
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
050315
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
050315
050315
050315
%preun
050315
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
050315
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
fafb58
fafb58
fafb58
%postun
050315
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
050315
then
050315
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
050315
    then
050315
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
050315
    fi
050315
65288d
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
65288d
    then
65288d
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
65288d
        then
65288d
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
65288d
            then
65288d
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
65288d
            else
65288d
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
65288d
            fi
65288d
        fi
65288d
    fi
65288d
050315
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
050315
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
050315
fi
050315
050315
050315
%posttrans
050315
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
050315
then
050315
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
050315
    then
050315
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
050315
    fi
050315
65288d
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
65288d
    then
65288d
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
65288d
        then
65288d
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
65288d
            then
65288d
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
65288d
            else
65288d
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
65288d
            fi
65288d
        fi
65288d
    fi
65288d
050315
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
050315
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
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
5bf30b
* Mon Aug 30 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-4
5bf30b
- Set specific kernel version to use
5bf30b
- Add Provides kernel-modules
5bf30b
- Add .%{_arch} to kernel-modules provides version
5bf30b
- Rebuild for 4.18.0-338.el8
5bf30b
a5b576
* Thu Aug 19 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-3
a5b576
- Rebuild for 4.18.0-331.el8
a5b576
95051e
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-2
c72d15
- Rebuild for 4.18.0-326.el8
95051e
- Fix provides/requires
95051e
- Fix kernel dependencies
95051e
- Add convenient provides kmod-aacraid-`uname -r`
95051e
- Fix installonlypkg detection
95051e
- Recreate source tarballs
95051e
- Rebuild for dist = .el8s
c72d15
f83540
* Wed Jul 21 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-1
60a62c
- Initial version