-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflowd.spec
188 lines (147 loc) · 4.62 KB
/
flowd.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
%define ver 0.9.1
%define rel 1
# Python < 2.3 (e.g. Redhat 9) doesn't have everything we need, so it may be
# necessary to turn off the python package on older systems
%define python_pkg 1
Summary: The flowd NetFlow collector daemon
Name: flowd
Version: %{ver}
Release: %{rel}
URL: http://www.mindrot.org/flowd.html
Source0: http://www.mindrot.org/files/flowd/flowd-%{ver}.tar.gz
License: BSD
Group: Applications/Internet
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
PreReq: initscripts
BuildPreReq: byacc
BuildPreReq: glibc-devel
BuildRequires: %{__python}
%package perl
Summary: Perl API to access flowd logfiles
Group: Applications/Internet
Requires: perl
%if %{python_pkg}
%package python
Summary: Python API to access flowd logfiles
Group: Applications/Internet
Requires: python
%endif
%package tools
Summary: Collection of example flowd tools
Group: Applications/Internet
%package devel
Summary: C API to access flowd logfiles
Group: Applications/Internet
%description
This is flowd, a NetFlow collector daemon intended to be small, fast and secure.
It features some basic filtering to limit or tag the flows that are recorded
and is privilege separated, to limit security exposure from bugs in flowd
itself.
%description perl
This is a Perl API to the binary flowd network flow log format and an example
reader application
%if %{python_pkg}
%description python
This is a Python API to the binary flowd network flow log format and an
example reader application
%endif
%description tools
A collection of tools for use with flowd
%description devel
This is a C API to the binary flowd network flow log format.
%prep
%setup
%build
[ -f configure -a -f flowd-config.h.in ] || autoreconf
%configure --enable-gcc-warnings
make
%if %{python_pkg}
./setup.py build
%endif
(cd Flowd-perl ; CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL \
PREFIX=$RPM_BUILD_ROOT/usr INSTALLDIRS=vendor; make )
%install
rm -rf $RPM_BUILD_ROOT
%makeinstall
# Misc stuff
install -d $RPM_BUILD_ROOT/var/empty
install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
install -m755 flowd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/flowd
# Perl module
(cd Flowd-perl; make install)
find ${RPM_BUILD_ROOT}/usr/lib*/perl5 \
\( -name perllocal.pod -o -name .packlist \) -exec rm -v {} \;
find ${RPM_BUILD_ROOT}/usr/lib*/perl5 \
-type f -print | sed "s@^$RPM_BUILD_ROOT@@g" > flowd-perl-filelist
find ${RPM_BUILD_ROOT}%{_mandir} \
-type f | grep -E '[0-9]pm(.gz)?$' | \
sed "s@^$RPM_BUILD_ROOT@@g;s@\$@*@" >> \
flowd-perl-filelist
if [ "$(cat flowd-perl-filelist)X" = "X" ] ; then
echo "ERROR: EMPTY FILE LIST"
exit -1
fi
# Python module
%if %{python_pkg}
./setup.py install --optimize 1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
sed -e 's|/[^/]*$||' INSTALLED_FILES | grep "site-packages/" | \
sort -u | awk '{ print "%attr(755,root,root) %dir " $1}' > INSTALLED_DIRS
cat INSTALLED_FILES INSTALLED_DIRS > INSTALLED_OBJECTS
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%pre
%{_sbindir}/groupadd -r _flowd 2>/dev/null || :
%{_sbindir}/useradd -d /var/empty -s /bin/false -g _flowd -M -r _flowd \
2>/dev/null || :
%post
/sbin/chkconfig --add flowd
%postun
/sbin/service flowd condrestart > /dev/null 2>&1 || :
%preun
if [ "$1" = 0 ]
then
/sbin/service flowd stop > /dev/null 2>&1 || :
/sbin/chkconfig --del flowd
fi
%files
%defattr(-,root,root)
%doc ChangeLog LICENSE README TODO
%dir %attr(0111,root,root) %{_var}/empty
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/flowd.conf
%attr(0644,root,root) %{_mandir}/man5/flowd.conf.5*
%attr(0644,root,root) %{_mandir}/man8/flowd.8*
%attr(0644,root,root) %{_mandir}/man8/flowd-reader.8*
%attr(0755,root,root) %{_bindir}/flowd-reader
%attr(0755,root,root) %config /etc/rc.d/init.d/flowd
%attr(0755,root,root) %{_sbindir}/flowd
%files perl -f flowd-perl-filelist
%defattr(-,root,root)
%doc reader.pl
%if %{python_pkg}
%files python -f INSTALLED_OBJECTS
%defattr(-,root,root)
%doc reader.py
%endif
%files tools
%defattr(-,root,root)
%doc tools/*
%files devel
%defattr(-,root,root)
%dir %attr(0755,root,root) %{_includedir}/flowd
%attr(0644,root,root) %{_includedir}/flowd/*
%attr(0644,root,root) %{_libdir}/libflowd.a
%changelog
* Wed Nov 03 2004 Damien Miller <[email protected]>
- Add devel subpackage
* Fri Sep 24 2004 Damien Miller <[email protected]>
- Add tools subpackage
* Tue Aug 17 2004 Damien Miller <[email protected]>
- Unbreak for Redhat 9
* Mon Aug 16 2004 Damien Miller <[email protected]>
- Make Python package optional, Redhat 9 doesn't have support for
socket.inet_ntop, which flowd.py needs
* Fri Aug 13 2004 Damien Miller <[email protected]>
- Subpackages for perl and python modules
* Tue Aug 03 2004 Damien Miller <[email protected]>
- Initial RPM spec