Add systemd unit file. Fixes bug #1313936

This commit is contained in:
Kevin Fenzi 2016-03-25 13:20:49 -06:00
parent 7e332e0e33
commit 59d2e797fc
2 changed files with 36 additions and 1 deletions

17
nftables.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=Netfilter Tables
Documentation=man:nft(8)
Wants=network-pre.target
Before=network-pre.target
[Service]
Type=oneshot
ProtectSystem=full
ProtectHome=true
ExecStart=/sbin/nft -f /etc/nftables.conf
ExecReload=/sbin/nft 'flush ruleset; include "/etc/nftables.conf";'
ExecStop=/sbin/nft flush ruleset
RemainAfterExit=yes
Install]
WantedBy=multi-user.target

View File

@ -3,7 +3,7 @@
Name: nftables
Version: 0.5
#Release: 0.1.%{snapdate}git%{?dist}
Release: 2%{?dist}
Release: 3%{?dist}
# Upstream released a 0.100 version, then 0.4. Need Epoch to get back on track.
Epoch: 1
Summary: Netfilter Tables userspace utillites
@ -12,6 +12,7 @@ License: GPLv2
URL: http://netfilter.org/projects/nftables/
#Source0: http://ftp.netfilter.org/pub/nftables/snapshot/nftables-%{snapdate}.tar.bz2
Source0: http://ftp.netfilter.org/pub/nftables/nftables-%{version}.tar.bz2
Source1: nftables.service
#BuildRequires: autogen
#BuildRequires: autoconf
@ -24,6 +25,7 @@ BuildRequires: gmp-devel
BuildRequires: readline-devel
BuildRequires: libnftnl-devel
BuildRequires: docbook2X
BuildRequires: systemd
%description
Netfilter Tables userspace utilities.
@ -42,13 +44,29 @@ make %{?_smp_mflags}
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
chmod 644 $RPM_BUILD_ROOT/%{_mandir}/man8/nft*
mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
cp -a %{SOURCE1} $RPM_BUILD_ROOT/%{_unitdir}/
%post
%systemd_post nftables.service
%preun
%systemd_preun nftables.service
%postun
%systemd_postun_with_restart nftables.service
%files
%doc COPYING TODO
%config(noreplace) %{_sysconfdir}/nftables/
%{_sbindir}/nft
%{_mandir}/man8/nft*
%{_unitdir}/nftables.service
%changelog
* Fri Mar 25 2016 Kevin Fenzi <kevin@scrye.com> - 0.5-3
- Add systemd unit file. Fixes bug #1313936
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1:0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild