From 205bc73fc97cdd1b9d37baae01906b94e0923cab Mon Sep 17 00:00:00 2001 From: Romain Fihue Date: Tue, 5 May 2020 09:29:31 +0200 Subject: [PATCH] Fix kpatch.spec Prior to this commit, the kpatch.spec was not building because of #1042. The kernel module is not built by default, but the spec was not updated accordingly. With this commit, the kpatch.spec supports building the module or not using a %bcond. Like the Makefile, it does not build the module by default. --- contrib/kpatch.spec | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/contrib/kpatch.spec b/contrib/kpatch.spec index 882d729..f096511 100644 --- a/contrib/kpatch.spec +++ b/contrib/kpatch.spec @@ -1,3 +1,9 @@ +# needed for the kernel specific module +%define KVER %(uname -r) + +# Don't build kpatch kernel module by default +%bcond_with kpatch_mod + Name: kpatch Summary: Dynamic kernel patching Version: 0.9.1 @@ -9,11 +15,12 @@ Source0: %{name}-%{version}.tar.gz Requires: kmod bash BuildRequires: gcc kernel-devel elfutils elfutils-devel +%if %{with kpatch_mod} +BuildRequires: kernel-devel-uname-r = %{KVER} +BuildRequires: kernel-uname-r = %{KVER} +%endif BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -# needed for the kernel specific module -%define KVER %(uname -r) - %description kpatch is a Linux dynamic kernel patching tool which allows you to patch a running kernel without rebooting or restarting any processes. It enables @@ -47,6 +54,7 @@ having to wait for long-running tasks to complete, users to log off, or for scheduled reboot windows. It gives more control over up-time without sacrificing security or stability. +%if %{with kpatch_mod} %package %{KVER} Requires: %{name} Summary: Dynamic kernel patching @@ -58,17 +66,18 @@ having to wait for long-running tasks to complete, users to log off, or for scheduled reboot windows. It gives more control over up-time without sacrificing security or stability. +%endif %prep %setup -q %build -make %{_smp_mflags} +make %{_smp_mflags} %{?with_kpatch_mod: BUILDMOD=yes KPATCH_BUILD=/lib/modules/%{KVER}/build} %install rm -rf %{buildroot} -make install PREFIX=/%{_usr} DESTDIR=%{buildroot} +make install PREFIX=/%{_usr} DESTDIR=%{buildroot} %{?with_kpatch_mod: BUILDMOD=yes KPATCH_BUILD=/lib/modules/%{KVER}/build} %clean rm -rf %{buildroot} @@ -81,9 +90,11 @@ rm -rf %{buildroot} %{_usr}/lib/systemd/system/* %{_sysconfdir}/init/kpatch.conf +%if %{with kpatch_mod} %files %{KVER} %defattr(-,root,root,-) %{_usr}/lib/kpatch/%{KVER} +%endif %files build %defattr(-,root,root,-)