File ferm.spec of Package ferm

#
# spec file for package ferm
#
# Copyright (c) 2021 SUSE LLC
#
# 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/
#


Name:           ferm
Version:        2.7
Release:        0
Summary:        A tool to maintain complex firewalls
License:        GPL-2.0-only
Group:          Productivity/Networking/Security
URL:            http://ferm.foo-projects.org/
#Git-Clone:     https://github.com/MaxKellermann/ferm.git
Source:         http://ferm.foo-projects.org/download/%{version}/%{name}-%{version}.tar.xz
Source1:        http://ferm.foo-projects.org/download/%{version}/%{name}-%{version}.tar.xz.sig
Source99:       %{name}.keyring
Patch0:         ferm-explicit_prototype.patch
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(systemd)
Requires:       iptables
Requires:       perl
Recommends:     perl-Net-DNS
BuildArch:      noarch

%description
ferm is a tool to maintain complex firewalls, without having the trouble to
rewrite the complex rules over and over again. ferm allows the entire firewall
rule set to be stored in a separate file, and to be loaded with one command.
The firewall configuration resembles structured programming-like language,
which can contain levels and lists.

%prep
%autosetup -p1
# set $prefix to "/usr" in the systemd service file
sed -i 's|@prefix@|/usr|g' ferm.service.in

%build

%install
make install PREFIX=%{buildroot}%{_prefix} SERVICEDIR=%{buildroot}%{_unitdir} MANDIR=%{buildroot}%{_mandir}/man1 DOCDIR=%{buildroot}%{_docdir}/ferm
install -d -m 0750 %{buildroot}%{_sysconfdir}/ferm/
install    -m 0640 examples/workstation.ferm %{buildroot}%{_sysconfdir}/ferm.conf

%pre
%service_add_pre %{name}.service

%preun
%service_del_preun %{name}.service

%post
%service_add_post %{name}.service

%postun
%service_del_postun %{name}.service

%files
%license COPYING
%doc %{_docdir}/ferm/
%config(noreplace) %{_sysconfdir}/ferm/
%config(noreplace) %{_sysconfdir}/ferm.conf
%{_sbindir}/ferm
%{_sbindir}/import-ferm
%{_mandir}/man1/ferm.1%{?ext_man}
%{_mandir}/man1/import-ferm.1%{?ext_man}
%{_unitdir}/ferm.service

%changelog
openSUSE Build Service is sponsored by