Files
kernel-livepatch-tools/kernel-livepatch-tools.spec

141 lines
4.8 KiB
RPMSpec

#
# spec file for package kernel-livepatch-tools
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# From dracut package
%define dracutlibdir %{_prefix}/lib/dracut
Name: kernel-livepatch-tools
%if 0%{?suse_version} >= 1600
Version: 1.8
%else
Version: 1.2
%endif
Release: 0
Summary: Scripts for installing kernel live patches
License: GPL-2.0-only
Group: System/Kernel
Source1: rpm-helper
Source2: dracut-module-setup.sh
Source3: dracut-kernel-livepatch.sh
Source4: kernel-livepatch-subpackage
Source5: macros.kernel-livepatch
Source6: klp.sh
Source7: klp.man
Source8: COPYING
Source12: sysconfig.livepatching
Source13: cache-cleaner
Source14: systemd-default-klp.preset
Source15: systemd-klp-info-cache.service.in
# compatibility with SLE 12, to be removed in SLE > 15
Source50: kgr.sh
Source51: kgr.man
Provides: kgraft = %version
Obsoletes: kgraft < %version
%if 0%{?suse_version} >= 1600
BuildArch: noarch
%endif
%description
This package contains a helper script used when installing kernel live patch
packages and kernel live patch monitoring tool.
%package devel
Summary: Macros for building kernel live patches
Group: Development/Tools/Building
# The OBS build does a testinstallation of all built packages, which needs
# the kernel-livepatch-tools runtime package
Requires: %{name}
Requires: kmod-compat
%description devel
This package contains RPM macro definitions for building kernel live patch
packages.
%prep
%setup -q -Tc
cp %{_sourcedir}/{rpm-helper,dracut-{module-setup,kernel-livepatch}.sh,sysconfig.livepatching} .
cp %{_sourcedir}/{kernel-livepatch-subpackage,macros.kernel-livepatch} .
cp %{_sourcedir}/k{lp,gr}.{sh,man} .
cp %{_sourcedir}/{cache-cleaner,systemd-{default-klp.preset,klp-info-cache.service.in}} .
cp %{_sourcedir}/COPYING .
%build
sed -e "s|@_LIBEXECDIR@|%{_libexecdir}|g" \
systemd-klp-info-cache.service.in >systemd-klp-info-cache.service
%install
install -D rpm-helper %{buildroot}%{_libexecdir}/kernel-livepatch/rpm-helper
install -D dracut-module-setup.sh \
%{buildroot}%{dracutlibdir}/modules.d/99kernel-livepatch/module-setup.sh
install -D dracut-kernel-livepatch.sh \
%{buildroot}%{dracutlibdir}/modules.d/99kernel-livepatch/kernel-livepatch.sh
install -D -m0644 kernel-livepatch-subpackage %{buildroot}%{_prefix}/lib/rpm/kernel-livepatch-subpackage
%if 0%{?suse_version} >= 1600
install -D -m0644 macros.kernel-livepatch %{buildroot}%{_rpmmacrodir}/macros.kernel-livepatch
%else
install -D -m0644 macros.kernel-livepatch %{buildroot}%{_sysconfdir}/rpm/macros.kernel-livepatch
%endif
install -D -m0755 klp.sh %{buildroot}%{_bindir}/klp
install -D -m0755 kgr.sh %{buildroot}%{_bindir}/kgr
sed -i 's/@@VERSION@@/%{version}-%{release}/' %{buildroot}%{_bindir}/klp
install -d %{buildroot}%{_mandir}/man8
gzip -c9 klp.man > %{buildroot}%{_mandir}/man8/klp.8.gz
gzip -c9 kgr.man > %{buildroot}%{_mandir}/man8/kgr.8.gz
install -D -m0755 cache-cleaner %{buildroot}%{_libexecdir}/kernel-livepatch/cache-cleaner
install -D -m0644 systemd-klp-info-cache.service %{buildroot}/%{_unitdir}/klp-info-cache.service
install -D -m0644 systemd-default-klp.preset %{buildroot}/%{_presetdir}/60-default-klp.preset
install -d %{buildroot}%{_docdir}
install -D -m 644 sysconfig.livepatching %{buildroot}%{_fillupdir}/sysconfig.livepatching
install -d %{buildroot}%{_localstatedir}/cache/livepatch/
%pre
%service_add_pre klp-info-cache.service
%post
%service_add_post klp-info-cache.service
%{fillup_only -n livepatching}
%preun
%service_del_preun klp-info-cache.service
%postun
%service_del_postun klp-info-cache.service
%files
%{_libexecdir}/kernel-livepatch
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/modules.d/99kernel-livepatch
%{_bindir}/k{lp,gr}
%{_mandir}/man8/k{lp,gr}.8%{ext_man}
%{_fillupdir}/*
%dir %{_localstatedir}/cache/livepatch/
%{_libexecdir}/kernel-livepatch/cache-cleaner
%{_unitdir}/klp-info-cache.service
%{_presetdir}/60-default-klp.preset
%license COPYING
%files devel
%if 0%{?suse_version} >= 1600
%{_rpmmacrodir}/macros.kernel-livepatch
%else
%{_sysconfdir}/rpm/macros.kernel-livepatch
%endif
%{_prefix}/lib/rpm/kernel-livepatch-subpackage
%changelog