File nftables-service.spec of Package nftables-service

#
# spec file for package nftables-service
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2020 Debian Netfilter Packaging Team <pkg-netfilter-team@lists.alioth.debian.org>
#
# 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 https://bugs.opensuse.org/
#


%define services nftables-early.service nftables.service
%define homedir /var/lib/nftables

Name:           nftables-service
Version:        1.3.0
Release:        0
Summary:        Service wrapper for nftables
License:        GPL-2.0-only
Group:          Productivity/Networking/Security
URL:            https://netfilter.org/projects/nftables/
Source0:        nftables.conf
Source1:        nftables-early.service
Source2:        nftables.service
Source3:        nftables-early-service
Source4:        nftables-service
Source5:        README.md
Source6:        TODO.md
Source7:        COPYING
BuildRequires:  pkgconfig
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(systemd)
Requires:       nftables
Requires(post): nftables
Requires(pre):  nftables
Requires(preun): nftables
BuildArch:      noarch

%description
Service wrapper for nftables inspired by Debian.

%prep

%build
cp %{SOURCE5} %{SOURCE6} %{SOURCE7} .

%install
install -D -d -m 0755        \
  %{buildroot}%{_sbindir}    \
  %{buildroot}%{_unitdir}    \
  %{buildroot}%{_sysconfdir}/nftables \
  %{buildroot}%{homedir}

#
install -m 0644 %{SOURCE0}            %{buildroot}%{_sysconfdir}/nftables.conf
touch                                 %{buildroot}%{_sysconfdir}/nftables-early.conf
#
install -m 0644 %{SOURCE1} %{SOURCE2} %{buildroot}%{_unitdir}
install -m 0755 %{SOURCE3} %{SOURCE4} %{buildroot}%{_sbindir}
#
ln -s %{_sbindir}/service             %{buildroot}%{_sbindir}/rcnftables
ln -s %{_sbindir}/service             %{buildroot}%{_sbindir}/rcnftables-early

%pre
%service_add_pre %{services}

%post
%service_add_post %{services}

%preun
%service_del_preun %{services}

%postun
%service_del_postun %{services}

%files
%doc README.md TODO.md
%license COPYING
#
%config(noreplace) %dir   %{_sysconfdir}/nftables/
%config(noreplace)        %{_sysconfdir}/nftables.conf
%config(noreplace) %ghost %{_sysconfdir}/nftables-early.conf
#
%{_unitdir}/nftables.service
%{_unitdir}/nftables-early.service
#
%{_sbindir}/nftables-service
%{_sbindir}/nftables-early-service
#
%{_sbindir}/rcnftables
%{_sbindir}/rcnftables-early

%dir %{homedir}

%changelog
openSUSE Build Service is sponsored by