Blob Blame History Raw
%define _default_patch_fuzz 2
Name: pads
Version: 1.2
Release: 8%{?dist}
Summary: Passive Asset Detection System
Group: Applications/System
License: GPLv2+
URL: http://passive.sourceforge.net/
Source0: http://prdownloads.sourceforge.net/passive/%{name}-%{version}.tar.gz
Source1: pads.service
Source2: pads.sysconfig
Patch1: pads-1.2-cleanup.patch
Patch2: pads-1.2-memleak.patch
Patch3: pads-1.2-overrun.patch
Patch4: pads-1.2-disable-debug.patch
Patch5: pads-1.2-daemonize.patch
Patch6: pads-1.2-ether-codes-update.patch
Patch7: pads-1.2-misc.patch
Patch8: pads-1.2-arp.patch
Patch9: pads-1.2-prelude.patch
Patch10: pads+vlan.patch
Patch11: pads-1.2-prelude-cleanup.patch
Patch12: pads-1.2-readonly.patch
Patch13: pads-1.2-bstring.patch
Patch14: pads-1.2-leak.patch
Patch15: pads-1.2-perf.patch
Patch16: pads-1.2-daemon.patch
Patch17: pads-1.2-pthreads.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: automake autoconf
BuildRequires: pcre-devel libpcap-devel
BuildRequires: libprelude-devel >= 0.9.21
#Requires(post)  : /sbin/chkconfig
#Requires(preun) : /sbin/chkconfig
#Requires(preun) : /sbin/service
#Requires(postun): /sbin/service
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units


%description
PADS is a libpcap based detection engine used to passively 
detect network assets.  It is designed to complement IDS 
technology by providing context to IDS alerts. When new assets
are found, it can send IDMEF alerts via prelude.

%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1

%build
autoreconf -fv --install
%configure --with-prelude
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
make install DESTDIR=%{buildroot}
install -m 755 %SOURCE1 %{buildroot}%{_unitdir}/%{name}.service
install -m 640 %SOURCE2 %{buildroot}%{_sysconfdir}/sysconfig/%{name}
# Remove installed docs since we pick this up another way
rm -rf $RPM_BUILD_ROOT/usr/share/pads/

%clean
rm -rf %{buildroot}

%post
#/sbin/chkconfig --add %{name}
if [ $1 -eq 1 ] ; then 
    # Initial installation 
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi


%preun
#if [ $1 = 0 ]; then
#        /sbin/service %{name} stop > /dev/null 2>&1 || :
#        /sbin/chkconfig --del %{name}
#fi
if [ $1 -eq 0 ] ; then
    # Package removal, not upgrade
    /bin/systemctl --no-reload pads.service > /dev/null 2>&1 || :
    /bin/systemctl stop pads.service > /dev/null 2>&1 || :
fi


%postun
#if [ "$1" -ge "1" ]; then
#        /sbin/service %{name} condrestart >/dev/null 2>&1 || :
#fi
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
    # Package upgrade, not uninstall
    /bin/systemctl try-restart pads.service >/dev/null 2>&1 || :
fi

%triggerun -- pads < 1.2-8
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply pads
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save pads >/dev/null 2>&1 ||:

# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del pads >/dev/null 2>&1 || :
/bin/systemctl try-restart pads.service >/dev/null 2>&1 || :


%files
%defattr(-,root,root,-)
%doc doc/AUTHORS doc/COPYING doc/README doc/ChangeLog
%{_sysconfdir}/pads-ether-codes
%{_sysconfdir}/pads-signature-list
%config(noreplace) %attr(0640,root,root) %{_sysconfdir}/pads.conf
%config(noreplace) %attr(0640,root,root) %{_sysconfdir}/sysconfig/%{name}
%attr(0755,root,root) %{_unitdir}/%{name}.service
%{_bindir}/pads
%{_bindir}/pads-report
%{_mandir}/*/*

%changelog
* Mon Feb 20 2012 Jon Ciesla <limburgher@gmail.com> - 1.2-8
- Migrate to systemd, BZ 661632.

* Fri Feb 10 2012 Petr Pisar <ppisar@redhat.com> - 1.2-7
- Rebuild against PCRE 8.30

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Tue Oct 28 2008 Steve Grubb <sgrubb@redhat.com> 1.2-2
- Update CFLAGS for newer libprelude (#465964)

* Tue Aug 12 2008 Steve Grubb <sgrubb@redhat.com> 1.2-1
 Initial rpm build with many bug fixes