Blob Blame History Raw
Name:		kpatch
Version:	0.0
Release:	1%{?dist}
Summary:	Dynamic kernel patch manager

Group:		System Environment/Kernel
License:	GPLv2
#URL:
Source0:	kpatch-%{version}.tar.gz

#BuildRequires:
Requires:	bash, systemd
Requires(post):	systemd

BuildArch:	noarch


%description
Kpatch is a dynamic kernel patch manager.  It allows the user to manage a
collection of binary kernel patches which can be used to dynamically patch the
kernel without rebooting.

%prep
%setup -q


%build


%install
make install DESTDIR=%{buildroot}


%post
# TODO: open bug to put kpatch in the preset policy instead and then use
# %systemd macros
# https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
if [ $1 -eq 1 ] ; then
    # Initial installation
    /bin/systemctl enable kpatch.service >/dev/null 2>&1 || :
fi


%preun
if [ $1 -eq 0 ] ; then
    # Package removal, not upgrade
    /bin/systemctl --no-reload disable kpatch.service > /dev/null 2>&1 || :
    /bin/systemctl stop kpatch.service > /dev/null 2>&1 || :
fi


%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
    # Package upgrade, not uninstall
    /bin/systemctl try-restart kpatch.service >/dev/null 2>&1 || :
fi


%files
%{_bindir}/*
%{_prefix}/lib/systemd/system/*


%changelog
* Thu Jan 30 2014 Josh Poimboeuf <jpoimboe@redhat.com> 0.0-1
- Initial build