Skip to content

Commit

Permalink
- Do not mark man ad %%doc.
Browse files Browse the repository at this point in the history
- Add systemd stuff.
- Provide separate user for service.
  • Loading branch information
Hubbitus committed Apr 24, 2014
1 parent c735d70 commit e499ca7
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
11 changes: 11 additions & 0 deletions SOURCES/darkstat.service
@@ -0,0 +1,11 @@
[Unit]
Description=Network traffic analyzer
After=syslog.target network.target

[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/darkstat
ExecStart=/usr/sbin/darkstat $OPTIONS

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions SOURCES/darkstat.sysconfig
@@ -0,0 +1,3 @@
# As base only specify network interface is mandatory.
# For more options see man darkstat
OPTIONS="-i p10p1"
36 changes: 33 additions & 3 deletions SPECS/darkstat.spec
@@ -1,14 +1,21 @@
Name: darkstat
Summary: Network traffic analyzer
Version: 3.0.718
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
Group: Applications/Internet
URL: http://unix4lyfe.org/darkstat/
Source: http://unix4lyfe.org/%{name}/%{name}-%{version}.tar.bz2

# My own systemd files
Source1: %{name}.service
Source2: %{name}.sysconfig
BuildRequires: libpcap-devel, zlib-devel

Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd

%description
darkstat is a network traffic analyzer. It's basically a packet sniffer
which runs as a background process on a cable/DSL router and gathers
Expand All @@ -24,12 +31,35 @@ make %{?_smp_mflags}
%install
make install DESTDIR="%{buildroot}"

install -Dp -m 0644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}.service
install -Dp -m 0644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}

%pre
getent passwd %{name} >/dev/null || useradd -r -s /sbin/nologin -c "Network traffic analyzer" %{name}
exit 0

%post
%systemd_post %{name}.service

%preun
%systemd_preun %{name}.service

%postun
%systemd_postun_with_restart %{name}.service

%files
%doc AUTHORS COPYING* LICENSE NEWS README *.txt
%doc %{_mandir}/man8/darkstat.8*
%{_mandir}/man8/darkstat.8*
%attr(755,-,-) %{_sbindir}/darkstat
%attr(0600,%{name},root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%{_unitdir}/%{name}.service

%changelog
* Thu Apr 24 2014 Pavel Alexeev <Pahan@Hubbitus.info> - - 3.0.718-2
- Do not mark man ad %%doc.
- Add systemd stuff.
- Provide separate user for service.

* Fri Mar 14 2014 Pavel Alexeev <Pahan@Hubbitus.info> - 3.0.718-1
- Imported from http://pkgs.repoforge.org/darkstat/darkstat-3.0.717-1.rf.src.rpm and rework to prepare for Fedora.
- Update to 3.0.718.
Expand Down

0 comments on commit e499ca7

Please sign in to comment.