eda019
Name:		kpatch
eda019
Version:	0.0
eda019
Release:	1%{?dist}
eda019
Summary:	Dynamic kernel patch manager
eda019
eda019
Group:		System Environment/Kernel
eda019
License:	GPLv2
eda019
#URL:
eda019
Source0:	kpatch-%{version}.tar.gz
eda019
eda019
#BuildRequires:
eda019
Requires:	bash, systemd
eda019
Requires(post):	systemd
eda019
eda019
BuildArch:	noarch
eda019
eda019
eda019
%description
eda019
Kpatch is a dynamic kernel patch manager.  It allows the user to manage a
eda019
collection of binary kernel patches which can be used to dynamically patch the
eda019
kernel without rebooting.
eda019
eda019
%prep
eda019
%setup -q
eda019
eda019
eda019
%build
eda019
eda019
eda019
%install
eda019
make install DESTDIR=%{buildroot}
eda019
eda019
eda019
%post
eda019
# TODO: open bug to put kpatch in the preset policy instead and then use
eda019
# %systemd macros
eda019
# https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
eda019
if [ $1 -eq 1 ] ; then
eda019
    # Initial installation
eda019
    /bin/systemctl enable kpatch.service >/dev/null 2>&1 || :
eda019
fi
eda019
eda019
eda019
%preun
eda019
if [ $1 -eq 0 ] ; then
eda019
    # Package removal, not upgrade
eda019
    /bin/systemctl --no-reload disable kpatch.service > /dev/null 2>&1 || :
eda019
    /bin/systemctl stop kpatch.service > /dev/null 2>&1 || :
eda019
fi
eda019
eda019
eda019
%postun
eda019
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
eda019
if [ $1 -ge 1 ] ; then
eda019
    # Package upgrade, not uninstall
eda019
    /bin/systemctl try-restart kpatch.service >/dev/null 2>&1 || :
eda019
fi
eda019
eda019
eda019
%files
eda019
%{_bindir}/*
eda019
%{_prefix}/lib/systemd/system/*
eda019
eda019
eda019
%changelog
eda019
* Thu Jan 30 2014 Josh Poimboeuf <jpoimboe@redhat.com> 0.0-1
eda019
- Initial build