File ferm.spec of Package ferm

# spec file for package ferm
# Copyright (c) 2016 SUSE LINUX Products 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

%if 0%{?suse_version} > 1230 || 0%{?rhel_version} > 600 || 0%{?centos_version} > 600 || 0%{?fedora_version} >= 20 || 0%{?el7}%{?fc20}%{?fc21}%{?fc22}%{?fc23}%{?fc24}%{?fc25}
%bcond_without  systemd
%bcond_with     systemd

Name:           ferm
Version:        2.5.1
Release:        0
License:        GPL-2.0
Summary:        A tool to maintain complex firewalls
Group:          Productivity/Networking/Security
%if %{with systemd}
BuildRequires:  pkgconfig(systemd)
Requires:       iptables
Requires:       perl
Recommends:     perl-Net-DNS
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

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.

%setup -q


make install PREFIX=%{buildroot}%{_prefix} SERVICEDIR=%{buildroot}%{_unitdir} MANDIR=%{buildroot}%{_mandir}/man1 DOCDIR=%{buildroot}%{_datadir}/doc/packages/ferm
%if %{with systemd}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
install -d -m 0750 %{buildroot}%{_sysconfdir}/ferm/
install    -m 0640 examples/workstation.ferm %{buildroot}%{_sysconfdir}/ferm.conf

%if %{with systemd}
%if 0%{?suse_version}
%service_add_pre %{name}.service

%if 0%{?suse_version}
%service_del_preun %{name}.service
%systemd_preun %{name}.service

%if 0%{?suse_version}
%service_add_post %{name}.service
%systemd_post %{name}.service

%if 0%{?suse_version}
%service_del_postun %{name}.service
%systemd_postun_with_restart %{name}.service

%config(noreplace) %{_sysconfdir}/ferm/
%config(noreplace) %{_sysconfdir}/ferm.conf
%if %{with systemd}
%if 0%{?suse_version}
%doc %{_datadir}/doc/packages/ferm/