File nfw.spec of Package nfw

#
# spec file for package nfw
#
# Copyright (c) 2022 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#

Name:           nfw
Version:        1.3.1
Release:        0
Summary:        Tiny and simple firewall
License:        GPL-2.0+
Group:          Productivity/Security
URL:            https://build.opensuse.org/project/show/home:microchip8/nfw
Source0:        %{name}-%{version}.tar.gz
Conflicts:      gufw
Conflicts:      shorewall
Conflicts:      ufw
Conflicts:      firewalld
Conflicts:      microfw
BuildRequires:  systemd
Requires:       nftables
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
nfw is a tiny and simple firewall. It basically loads saved nftables rules
from %{_sysconfdir}/sysconfig/network/nfrules.nft

%prep
%setup -q

%build


%install

install -D -m 644 %{name}.service %{buildroot}/%{_unitdir}/%{name}.service

install -D -m 644 nfrules.nft %{buildroot}/%{_sysconfdir}/sysconfig/network/nfrules.nft

%pre
%service_add_pre %{name}.service

%post
%fillup_only %{name}
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service


%files
%defattr(-,root,root)
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/sysconfig/network/nfrules.nft
%doc README LICENSE AUTHORS ChangeLog

%changelog
openSUSE Build Service is sponsored by