# - pldize initscript
# - unbash initscript
# - recheck deps
-Summary: A powerful yet easy to use iptables frontend
+Summary: Simple and powerful firewall and traffic shaping languages
Name: firehol
-Version: 1.273
+Version: 2.0.1
Release: 0.1
License: GPL v2+
Group: Applications/Networking
-Source0: http://downloads.sourceforge.net/firehol/%{name}-%{version}.tar.bz2
-# Source0-md5: cbbe1ba21cf44955827d5c906a55aa21
-Patch0: pld.patch
-URL: http://firehol.sourceforge.net
-BuildRequires: rpmbuild(macros) >= 1.228
-Requires: bash >= 2.04
-Requires: fileutils >= 4.0.36
+Source0: http://firehol.org/download/firehol/releases/v%{version}/%{name}-%{version}.tar.xz
+# Source0-md5: e2672c82b2b6012f9000c15c08c7dc89
+Source1: %{name}.service
+Source2: fireqos.service
+URL: http://firehol.org
+BuildRequires: hostname
+BuildRequires: iproute2
+BuildRequires: iptables
+BuildRequires: procps
+BuildRequires: systemd-devel
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
+Requires(post,preun): /sbin/chkconfig
+Requires: coreutils
Requires: gawk >= 3.0
Requires: grep >= 2.4.2
+Requires: gzip
+Requires: hostname
Requires: iproute2 >= 2.2.4
Requires: iptables >= 1.2.4
-Requires: kernel >= 2.4
+Requires: kmod
Requires: less
-Requires: modutils >= 2.4.13
-Requires: net-tools >= 1.57
-Requires: sed >= 3.02
-Requires: sh-utils >= 2.0
-Requires: textutils >= 2.0.11
-Requires: util-linux >= 2.11
-Requires(post,preun): /sbin/chkconfig
+Requires: procps
Requires: rc-scripts
+Requires: sed
+Requires: uname(release) >= 2.4
+Requires: util-linux >= 2.11
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%prep
%setup -q
-%patch0 -p1
+
+%build
+%configure
+%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-install -D -p firehol.sh $RPM_BUILD_ROOT%{_initrddir}/firehol
-install -D -p examples/client-all.conf $RPM_BUILD_ROOT%{_sysconfdir}/firehol/firehol.conf
+%{__make} install \
+ DESTDIR=$RPM_BUILD_ROOT
-# Install man files
-install -d $RPM_BUILD_ROOT%{_mandir}/man{1,5}
-install -p man/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1
-install -p man/*.5 $RPM_BUILD_ROOT/%{_mandir}/man5
+# Hack for documentation without crufts.
+rm -frv $RPM_BUILD_ROOT%{_docdir}
+find examples/ -name "Makefile*" -delete -print
-# Executables
-install -d $RPM_BUILD_ROOT%{_libdir}/firehol
-install -p *.sh $RPM_BUILD_ROOT%{_libdir}/firehol
+# Install systemd units.
+install -d $RPM_BUILD_ROOT%{systemdunitdir}
+cp -p %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}
-# Install runtime directories
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/firehol/services
+# Install runtime directories.
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/services
install -d $RPM_BUILD_ROOT%{_localstatedir}/spool/firehol
+# Ghost configurations.
+touch $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/firehol.conf \
+ $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/fireqos.conf
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
%post
/sbin/chkconfig --add firehol
%service firehol restart
+%systemd_post firehol.service
+%systemd_post fireqos.service
%preun
if [ "$1" = 0 ]; then
%service firehol stop
/sbin/chkconfig --del firehol
fi
+%systemd_preun firehol.service
+%systemd_preun fireqos.service
-%clean
-rm -rf $RPM_BUILD_ROOT
+%postun
+%systemd_reload
%files
%defattr(644,root,root,755)
-%doc README TODO ChangeLog WhatIsNew examples doc
+%doc AUTHORS NEWS README THANKS examples
+%doc doc/firehol/firehol-manual.{pdf,html}
+%doc doc/fireqos/fireqos-manual.{pdf,html}
%dir %{_sysconfdir}/firehol
-%config(noreplace) %{_sysconfdir}/firehol/firehol.conf
-%attr(754,root,root) /etc/rc.d/init.d/firehol
-%{_libdir}/firehol
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/firehol.conf
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/fireqos.conf
+%{_sysconfdir}/%{name}/*.example
+%dir %{_sysconfdir}/%{name}/services
+%{_sysconfdir}/%{name}/services/*.example
+%attr(755,root,root) %{_sbindir}/firehol
+%attr(755,root,root) %{_sbindir}/fireqos
%{_mandir}/man1/*.1*
%{_mandir}/man5/*.5*
-%{_sysconfdir}/firehol/services
-%{_localstatedir}/spool/firehol
+%{systemdunitdir}/firehol.service
+%{systemdunitdir}/fireqos.service
+%{_localstatedir}/spool/%{name}