File shorewall.spec of Package shorewall

#
# spec file for package shorewall
#
# Copyright (c) 2011 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 http://bugs.opensuse.org/
#



Name:           shorewall
Version:        4.4.24.1
Release:        1
License:        GPL-2.0
Summary:        Shoreline Firewall is an iptables-based firewall for Linux systems
Url:            http://www.shorewall.net/
Group:          Productivity/Networking/Security
Source0:        http://www.shorewall.net/pub/shorewall/4.4/shorewall-4.4.24/%name-%version.tar.bz2
Source1:        http://www.shorewall.net/pub/shorewall/4.4/shorewall-4.4.24/%name-lite-%version.tar.bz2
Source2:        http://www.shorewall.net/pub/shorewall/4.4/shorewall-4.4.24/%name-init-%version.tar.bz2
Source3:        http://www.shorewall.net/pub/shorewall/4.4/shorewall-4.4.24/%{name}6-lite-%version.tar.bz2
Source4:        http://www.shorewall.net/pub/shorewall/4.4/shorewall-4.4.24/%{name}6-%version.tar.bz2
Source5:        http://www.shorewall.net/pub/shorewall/4.4/shorewall-4.4.24/%name-docs-html-%version.tar.bz2
Source6:        %name-4.4.22.rpmlintrc
Source7:        README.openSUSE
# PATCH-FIX-UPSTREAM init-4.4.14 toganm@opensuse.org -- Required-Stop and Short descriprtion
Patch0:         init-4.4.14.patch
# PATCH-FIX-UPSTREAM shorewall-lite-4.4.14.init.patch toganm@opensuse.org Required-Stop and Short descriprtion
Patch1:         shorewall-lite-4.4.14.init.patch
# PATCH-FIX-UPSTREAM shorewall6-init-4.4.14.patch toganm@opensuse.org Required-Stop and Short descriprtion
Patch2:         shorewall6-init-4.4.14.patch
# PATCH-FIX-UPSTREAM shorewall6-lite-4.4.14.init.patch toganm@opensuse.org Required-Stop and Short descriprtion
Patch3:         shorewall6-lite-4.4.14.init.patch
# PATCH-FIX-UPSTREAM shorewall-init-4.4.21_init_sh.patch toganm@opensuse.org
# Required-Start/Stop 
Patch4:         shorewall-init-4.4.21_init_sh.patch
# PATCH-FIX-OPENSUSE install-4.4.14.patch toganm@opensuse.org -- use of fillup template
Patch5:         install-4.4.14.patch

%if 0%{?suse_version} > 1140
Requires(pre):      systemd
Requires(post):     systemd
Requires(preun):    systemd
Requires(postun):   systemd
%else
PreReq:         %fillup_prereq
PreReq:         %insserv_prereq
%endif
Requires:       xtables-addons
Requires:       iproute2
Requires:       iptables

%if 0%{?suse_version} < 1140
Requires:       perl = %{perl_version}
%else
%{perl_requires}
%endif
Requires:       logrotate
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%if 0%{?suse_version}>1140
BuildRequires:  systemd
%systemd_requires
%endif

Conflicts:      SuSEfirewall2

%description
The Shoreline Firewall, more commonly known as "Shorewall", is a Netfilter
(iptables) based firewall that can be used on a dedicated firewall system,
a multi-function gateway/ router/server or on a standalone GNU/Linux system.

%package lite

Summary:        Shoreline Firewall Lite is an iptables-based firewall for Linux systems
Group:          Productivity/Networking/Security
%if 0%{?suse_version} > 1140
Requires(pre):      systemd
Requires(post):     systemd
Requires(preun):    systemd
Requires(postun):   systemd
%else
PreReq:         %fillup_prereq
PreReq:         %insserv_prereq
%endif
Requires:       bc
Requires:       iproute2
Requires:       iptables
Requires:       logrotate

Conflicts:      SuSEfirewall2

%description lite
The Shoreline Firewall, more commonly known as "Shorewall", is a Netfilter
(iptables) based firewall that can be used on a dedicated firewall system,
a multi-function gateway/ router/server or on a standalone GNU/Linux system.

Shorewall Lite is a companion product to Shorewall that allows network
administrators to centralize the configuration of Shorewall-based firewalls.

%package -n %{name}6

Summary:        Shoreline Firewall 6 is an ip6tables-based firewall for Linux systems
%if 0%{?suse_version} > 1140
Requires(pre):      systemd
Requires(post):     systemd
Requires(preun):    systemd
Requires(postun):   systemd
%else
PreReq:         %fillup_prereq
PreReq:         %insserv_prereq
%endif
Requires:       logrotate
Conflicts:      SuSEfirewall2
Group:          Productivity/Networking/Security

%description -n %{name}6
The Shoreline Firewall 6, more commonly known as "Shorewall6", is a Netfilter
(ip6tables) based IPv6 firewall that can be used on a dedicated firewall system,
a multi-function gateway/ router/server or on a standalone GNU/Linux system.

%package -n %{name}6-lite

Summary:        Shoreline Firewall 6 Lite is an ip6tables-based firewall for Linux systems
%if 0%{?suse_version} > 1140
Requires(pre):      systemd
Requires(post):     systemd
Requires(preun):    systemd
Requires(postun):   systemd
%else
PreReq:         %fillup_prereq
PreReq:         %insserv_prereq
%endif
Requires:       logrotate
Conflicts:      SuSEfirewall2
Group:          Productivity/Networking/Security

%description -n %{name}6-lite
The Shoreline Firewall 6, more commonly known as "Shorewall6", is a Netfilter
(ip6tables) based firewall that can be used on a dedicated firewall system,
a multi-function gateway/ router/server or on a standalone GNU/Linux system.

Shorewall6 Lite is a companion product to Shorewall6 that allows network
administrators to centralize the configuration of Shorewall6-based firewalls.

%package  init

Summary:        Adds functionality to Shoreline Firewall (Shorewall)
%if 0%{?suse_version} > 1140
Requires(pre):      systemd
Requires(post):     systemd
Requires(preun):    systemd
Requires(postun):   systemd
%else
PreReq:         %fillup_prereq
PreReq:         %insserv_prereq
%endif
Requires:       logrotate
Requires:       %name > 4.4.9 
Requires:       %{name}6 > 4.4.9
Group:          Productivity/Networking/Security

%description init
The Shoreline Firewall, more commonly known as "Shorewall", is a Netfilter
(iptables) based firewall that can be used on a dedicated firewall system,
a multi-function gateway/ router/server or on a standalone GNU/Linux system.

Shorewall Init is a companion product to Shorewall that allows for tigher
control of connections during boot and that integrates Shorewall with
ifup/ifdown and NetworkManager.

%package  docs
Summary:        HTML documentation for shorewall configuration
Group:          Documentation/Other
License:        FDLv1.2+

%description  docs
HTML documentation for the Shoreline Firewall. Highly recommend to read before
starting to configure shorewall



%prep
%setup -q  -c -a1 -a2 -a3 -a4 -a5

# Remove hash-bang from files which are not directly executed as shell
# scripts. This silences some rpmlint errors.
# corrected upstream so no more need
#find . -name "lib.*" -exec sed -i -e '/\#\!\/bin\/sh/d' {} \;

# apply patches to shorewall if version less 12.1
pushd %name-%version
%patch0
popd

# apply patches to shorewall-lite
pushd %name-lite-%version
%patch1
popd

# apply patches to shorewall6
pushd %{name}6-%version
%patch2
popd

# apply patches to shorewall-lite
pushd %{name}6-lite-%version
%patch3
popd
# apply patches to shorewall-lite
pushd %name-init-%version
%patch4
%patch5
popd

chmod -x  %name-docs-html-%version/images/*.png
chmod -x %{name}6-%version/tunnel
chmod -x %{name}6-%version/ipv6
chmod -x %name-%version/Contrib/swping.init
chmod -x %name-%version/Contrib/tunnel

cp %{S:7} %name-%version/.

%build

%install
%if 0%{?suse_version}>1140
export SYSTEMD="Yes";\
%endif

export LIBEXEC=%_libexecdir ;\
export PERLLIB=%perl_vendorlib ;\
export OWNER="root" ; \
export SUSE="Yes";\
export GROUP="root"

pushd %name-%version
PREFIX=%buildroot DEST=%_initddir %_buildshell install.sh
popd
pushd %name-lite-%version
PREFIX=%buildroot DEST=%_initddir %_buildshell install.sh
popd
pushd %{name}6-%version
PREFIX=%buildroot DEST=%_initddir %_buildshell install.sh
popd
pushd %{name}6-lite-%version
PREFIX=%buildroot DEST=%_initddir %_buildshell install.sh
popd
pushd %name-init-%version
%__mkdir_p %buildroot%_sysconfdir/NetworkManager/dispatcher.d/ 
PREFIX=%buildroot DEST=%_initddir %_buildshell  install.sh
popd

%pre
%if 0%{?suse_version}>1140
%service_add_pre shorewall.service
%endif

%post
%{fillup_and_insserv -f %name}
%if 0%{?suse_version}>1140
%service_add_post shorewall.service
%endif

%preun
%{stop_on_removal %name}
rm -f %_sysconfdir/%name/startup_disabled
%if 0%{?suse_version}>1140
%service_del_preun shorewall.service 
%endif

%postun
%restart_on_update %name
%insserv_cleanup
%stop_on_removal

%if 0%{?suse_version}>1140
%service_del_postun shorewall.service
%endif

%pre -n %{name}6
%if 0%{?suse_version}>1140
%service_add_pre shorewall6.service
%endif

%post -n %{name}6
%{fillup_and_insserv -f %{name}6}

%if 0%{?suse_version}>1140
%service_add_post shorewall6.service
%endif

%preun -n %{name}6
%{stop_on_removal %{name}6}
rm -f %_sysconfdir/%name/startup_disabled

%if 0%{?suse_version}>1140
%service_del_preun shorewall6.service 
%endif

%postun -n %{name}6
%restart_on_update %{name}6
%insserv_cleanup
%stop_on_removal

%if 0%{?suse_version}>1140
%service_del_postun shorewall6.service
%endif

%pre -n %{name}-lite
%if 0%{?suse_version}>1140
%service_add_pre shorewall-lite.service
%endif

%post -n %name-lite
%{fillup_and_insserv -f %name-lite}
%if 0%{?suse_version}>1140
%service_add_post shorewall-lite.service
%endif

%preun -n %name-lite
%{stop_on_removal %name-lite}
rm -f %_sysconfdir/%name/startup_disabled

%if 0%{?suse_version}>1140
%service_del_preun shorewall-lite.service 
%endif

%postun -n %name-lite
%restart_on_update %name-lite
%insserv_cleanup
%stop_on_removal

%if 0%{?suse_version}>1140
%service_del_postun shorewall-lite.service
%endif

%pre -n %{name}6-lite
%if 0%{?suse_version}>1140
%service_add_pre shorewall6-lite.service
%endif

%post -n %{name}6-lite
%{fillup_and_insserv -f %{name}6-lite}

%if 0%{?suse_version}>1140
%service_add_post shorewall6-lite.service
%endif

%preun -n %{name}6-lite
%{stop_on_removal %{name}6-lite}
rm -f %_sysconfdir/%name/startup_disabled

%if 0%{?suse_version}>1140
%service_del_preun shorewall6-lite.service 
%endif

%postun -n %{name}6-lite
%restart_on_update %{name}6-lite
%insserv_cleanup
%stop_on_removal

%if 0%{?suse_version}>1140
%service_del_postun shorewall6-lite.service
%endif

%pre init
%if 0%{?suse_version}>1140
%service_add_pre shorewall-init.service
%endif

%post  init
%{fillup_and_insserv -n %name-init}

%if 0%{?suse_version}>1140
%service_add_post shorewall-init.service
%endif

%postun  init
%restart_on_update %name-init
%insserv_cleanup
%stop_on_removal
%if 0%{?suse_version}>1140
%service_del_postun shorewall-init.service
%endif

%preun  init
%{stop_on_removal %name-init}

%if 0%{?suse_version}>1140
%service_del_preun shorewall-init.service 
%endif

%files
%defattr(-,root,root,-)
%attr(0544,root,root) %_initddir/%name
%dir %_sysconfdir/%name
%dir %_datadir/%name
%dir %_libexecdir/%name
%dir %_datadir/%name/configfiles
%dir %_datadir/%name/Shorewall
%attr(0700,root,root) %dir %{_localstatedir}/lib/%name
%config(noreplace) %_sysconfdir/%name/*

%config(noreplace) %_sysconfdir/logrotate.d/%name

%attr(0755,root,root) /sbin/%name

%_datadir/%name/version
%_datadir/%name/actions.std
%_datadir/%name/action.*
%attr(-   ,root,root) %_datadir/%name/functions
%_datadir/%name/lib.*
%_datadir/%name/macro.*
%_datadir/%name/modules
%_datadir/%name/modules.*
%_datadir/%name/helpers
%_datadir/%name/configpath
%_libexecdir/%name/getparams
%attr(0755,root,root) %_libexecdir/%name/wait4ifup

%attr(755,root,root) %_libexecdir/%name/compiler.pl
%_datadir/%name/prog.*
%dir %perl_vendorlib/Shorewall
%perl_vendorlib/Shorewall/*.pm

%_datadir/%name/configfiles/*

%_mandir/man5/%name-[a-k,m-z]*.5*
%_mandir/man5/%name.conf.5*
%_mandir/man8/%name.8*

%doc %name-%version/COPYING
%doc %name-%version/INSTALL
%doc %name-%version/changelog.txt
%doc %name-%version/releasenotes.txt
%doc %name-%version/Contrib/*
%doc %name-%version/Samples
%doc %name-%version/README.openSUSE

%if 0%{?suse_version}>1140
%attr(600,root,root) /lib/systemd/system/*.service
%endif

%files lite
%defattr(-,root,root,-)

%dir %_sysconfdir/%name-lite
%config(noreplace) %_sysconfdir/%name-lite/%name-lite.conf
%config %_sysconfdir/%name-lite/Makefile

%attr(0544,root,root) %_initddir/%name-lite

%dir %_datadir/%name-lite
%dir %_libexecdir/%name-lite
%attr(0700,root,root) %dir %{_localstatedir}/lib/%name-lite

%config(noreplace) %_sysconfdir/logrotate.d/%name-lite

%attr(0755,root,root) /sbin/%name-lite

%_datadir/%name-lite/version
%_datadir/%name-lite/configpath
%attr(-   ,root,root) %_datadir/%name-lite/functions
%_datadir/%name-lite/lib.*
%_datadir/%name-lite/modules
%_datadir/%name-lite/modules.*
%_datadir/%name-lite/helpers
%attr(0544,root,root) %_libexecdir/%name-lite/shorecap
%attr(0755,root,root) %_libexecdir/%name-lite/wait4ifup

%_mandir/man5/%name-lite*.5*
%_mandir/man8/%name-lite.8.*

%doc %name-lite-%version/COPYING
%doc %name-lite-%version/changelog.txt
%doc %name-lite-%version/releasenotes.txt

%files -n %{name}6
%defattr(-,root,root,-)
%attr(0544,root,root) %_initddir/%{name}6
%dir %_sysconfdir/%{name}6
%dir %_datadir/%{name}6
%dir %_libexecdir/%{name}6
%dir %_datadir/%{name}6/configfiles
%attr(0700,root,root) %dir %{_localstatedir}/lib/%{name}6
%config(noreplace) %_sysconfdir/%{name}6/*
%attr(0600,root,root) %config %_sysconfdir/%{name}6/Makefile

%config(noreplace) %_sysconfdir/logrotate.d/%{name}6

%attr(0755,root,root) /sbin/%{name}6

%_datadir/%{name}6/version
%_datadir/%{name}6/actions.std
%_datadir/%{name}6/action.*

%attr(-   ,root,root) %_datadir/%{name}6/functions
%_datadir/%{name}6/lib.*
%_datadir/%{name}6/macro.*
%_datadir/%{name}6/modules
%_datadir/%{name}6/modules.*
%_datadir/%{name}6/helpers
%_datadir/%{name}6/configpath
%attr(0755,root,root) %_libexecdir/%{name}6/wait4ifup

%_datadir/%{name}6/configfiles/*

%_mandir/man5/%{name}6-[a-k,m-z]*.5*
%_mandir/man5/%{name}6.conf.5*
%_mandir/man8/%{name}6.8*

%doc %{name}6-%version/COPYING
%doc %{name}6-%version/INSTALL
%doc %{name}6-%version/changelog.txt
%doc %{name}6-%version/releasenotes.txt
%doc %{name}6-%version/tunnel
%doc %{name}6-%version/ipsecvpn
%doc %{name}6-%version/ipv6
%doc %{name}6-%version/Samples6

%files -n %{name}6-lite
%defattr(-,root,root,-)

%_mandir/man5/%{name}6-lite*.5*
%_mandir/man8/%{name}6-lite.8*

%doc %{name}6-lite-%version/COPYING
%doc %{name}6-lite-%version/changelog.txt
%doc %{name}6-lite-%version/releasenotes.txt

%dir %_sysconfdir/%{name}6-lite
%config(noreplace) %_sysconfdir/%{name}6-lite/%{name}6-lite.conf
%config %_sysconfdir/%{name}6-lite/Makefile
%attr(0544,root,root) %_initddir/%{name}6-lite
%dir %_datadir/%{name}6-lite
%dir %_libexecdir/%{name}6-lite
%attr(0700,root,root) %dir %{_localstatedir}/lib/%{name}6-lite

%config(noreplace) %_sysconfdir/logrotate.d/%{name}6-lite

%attr(0755,root,root) /sbin/%{name}6-lite

%_datadir/%{name}6-lite/version
%_datadir/%{name}6-lite/configpath
%attr(-   ,root,root) %_datadir/%{name}6-lite/functions
%_datadir/%{name}6-lite/lib.base
%_datadir/%{name}6-lite/lib.cli
%_datadir/%{name}6-lite/lib.common
%_datadir/%{name}6-lite/modules
%_datadir/%{name}6-lite/modules.*
%_datadir/%{name}6-lite/helpers
%attr(0544,root,root) %_libexecdir/%{name}6-lite/shorecap
%attr(0755,root,root) %_libexecdir/%{name}6-lite/wait4ifup

%files init
%defattr(-,root,root,-)
%_localstatedir/adm/fillup-templates/sysconfig.%name-init
%attr(0544,root,root) %config(noreplace) %_sysconfdir/init.d/%name-init
%dir %_datadir/%name-init
%dir %_libexecdir/%name-init
%dir %attr(0755,root,root) %_sysconfdir/NetworkManager
%dir %attr(0755,root,root) %_sysconfdir/NetworkManager/dispatcher.d
%attr(0755,root,root) %_sysconfdir/NetworkManager/dispatcher.d/01-%name
%_datadir/%name-init/version
%attr(0544,root,root) %_libexecdir/%name-init/ifupdown

%attr(0544,root,root) %_sysconfdir/sysconfig/network/if-down.d/%name
%attr(0755,root,root) %_sysconfdir/sysconfig/network/if-up.d/%name
%_mandir/man8/%name-init.8*

%doc %name-init-%version/COPYING
%doc %name-init-%version/changelog.txt
%doc %name-init-%version/releasenotes.txt

%files  docs
%defattr(-,root,root,-)
%doc %name-docs-html-%version/*

%changelog
openSUSE Build Service is sponsored by