File portsentry.spec of Package portsentry

Name:		portsentry

Version:	2.0.6
Release:	%autorelease
Summary:	Tool to detect and respond to port scans

License:	BSD-2-Clause AND BSD-1-Clause
URL:		https://portsentry.xyz/
Source0:	%{name}_%{version}.orig.tar.gz

BuildRequires:	cmake
BuildRequires:	gcc
BuildRequires:	gcc-c++
BuildRequires:	libpcap-devel
BuildRequires:	systemd-rpm-macros

Requires:	logrotate

%description
Portsentry monitors network traffic in order to detect port scans in
real-time. It can identify several types of scans, including TCP, SYN,
FIN, XMAS, and NULL scans and UDP probing.

%prep
%autosetup -n portsentry-%{version} -p1


%build
# Why isn't CMAKE_INSTALL_SYSCONFDIR predefined by the macro?
# CMAKE_INSTALL_LIBDIR defaults to lib64, but is used for systemd
# definitions which should go to lib. Is there a more correct way to
# change this?
%cmake -D CMAKE_BUILD_TYPE=Release \
       -D BUILD_TESTS=ON \
       -D CMAKE_VERBOSE_MAKEFILE:BOOL=ON \
       -D INSTALL_LICENSE=OFF \
       -D CMAKE_INSTALL_SYSCONFDIR=%_sysconfdir \
       -D CMAKE_INSTALL_LIBDIR=lib \
       -D SYSTEMD_SYSTEM_UNIT_DIR=%_unitdir
%cmake_build


%install
%cmake_install


%check
%ctest


%post
%systemd_post %name.service

%preun
%systemd_preun %name.service

%postun
%systemd_postun_with_restart %name.service


%files
%license LICENSE
%_mandir/man8/%name.8.gz
%_mandir/man8/%name.conf.8.gz
%_unitdir/%name.service
%dir %_sysconfdir/%name
%config(noreplace) %_sysconfdir/%name/*
%_sbindir/%name
%config(noreplace) %_sysconfdir/logrotate.d/%name
%doc %{_docdir}/%{name}
openSUSE Build Service is sponsored by