Blame SPECS/kmod-wireguard.spec

39a588
%global pkg wireguard
39a588
654c2d
%global kernel_version 4.18.0-305.12.1.el8_4
39a588
39a588
%global _use_internal_dependency_generator 0
39a588
%global __find_requires %{nil}
39a588
%global __find_provides /usr/lib/rpm/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
01a011
Release:          3%{?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
39a588
ExclusiveArch:    x86_64 aarch64
39a588
39a588
BuildRequires:    elfutils-libelf-devel
39a588
BuildRequires:    gcc
39a588
BuildRequires:    kmod
39a588
BuildRequires:    make
39a588
BuildRequires:    redhat-rpm-config
39a588
BuildRequires:    xz
39a588
39a588
BuildRequires:    kernel-devel = %{kernel_version}
39a588
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
39a588
39a588
Requires:         kernel-core = %{kernel_version}
39a588
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
39a588
Requires:         kernel-modules = %{kernel_version}
39a588
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
39a588
39a588
Provides:         installonlypkg(kernel-module)
032843
Provides:         kernel-modules = %{kernel_version}.%{_arch}
39a588
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
39a588
39a588
Requires(post):   /usr/sbin/depmod
39a588
Requires(postun): /usr/sbin/depmod
39a588
39a588
Requires(post):   /usr/bin/dracut
39a588
Requires(postun): /usr/bin/dracut
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
39a588
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
39a588
39a588
39a588
%preun
39a588
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
39a588
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
39a588
39a588
39a588
%postun
39a588
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
39a588
then
39a588
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
39a588
    then
39a588
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
39a588
    fi
39a588
39a588
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
39a588
    then
39a588
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
39a588
        then
39a588
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
39a588
            then
39a588
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
39a588
            else
39a588
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
39a588
            fi
39a588
        fi
39a588
    fi
39a588
39a588
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
39a588
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
39a588
fi
39a588
39a588
39a588
%posttrans
39a588
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
39a588
then
39a588
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
39a588
    then
39a588
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
39a588
    fi
39a588
39a588
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
39a588
    then
39a588
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
39a588
        then
39a588
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
39a588
            then
39a588
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
39a588
            else
39a588
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
39a588
            fi
39a588
        fi
39a588
    fi
39a588
39a588
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
39a588
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
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
01a011
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-3
01a011
- Rebuild for 4.18.0-305.12.1.el8_4
01a011
39a588
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-2
39a588
- Initial version