File openvas-scanner.spec of Package openvas-scanner
#
# spec file for package openvas-scanner
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: openvas-scanner
Version: 3.2.5
Release: 1.0
License: GPLv2
Group: Productivity/Networking/Security
URL: http://www.openvas.org
Source0: %{name}-%{version}.tar.gz
Source1: openvassd.logrotate
Source2: debian.openvas-scanner.default
Source3: openvassd.init.suse
Source4: openvassd.init.fedora
Source5: openvassd.init.mandriva
Patch0: openvas-scanner-3.2.4-linking.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?mandriva_version}
BuildRequires: pinentry-gtk2
%endif
%if 0%{?suse_version}
PreReq: %insserv_prereq
PreReq: %fillup_prereq
%if 0%{?suse_version} > 1130
BuildRequires: openssl
%endif
%endif
BuildRequires: cmake
BuildRequires: glib2-devel
BuildRequires: libopenvas-devel >= 4.0.0
BuildRequires: libgcrypt-devel
BuildRequires: pkgconfig
Requires: logrotate
Requires: openssl
Requires: rsync
Summary: The Scanner Module for OpenVAS
%description
This is the scanner module for the Open Vulnerability Assessment System (OpenVAS).
%prep
%setup -q
%patch0
%build
%if 0%{?mandriva_version}
%serverbuild
%endif
export CFLAGS="$RPM_OPT_FLAGS"
cmake -DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DSYSCONFDIR=%{_sysconfdir} \
-DLIBDIR=%{_libdir} \
-DLOCALSTATEDIR=%{_localstatedir} \
-DCMAKE_BUILD_TYPE=release
%__make %{?_smp_mflags}
%install
%__make install DESTDIR=%{buildroot}
%__install -Dm 0644 %{_sourcedir}/openvassd.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/openvas-scanner
%if 0%{?suse_version}
%__install -Dm 0755 %{_sourcedir}/openvassd.init.suse %{buildroot}%{_initrddir}/openvas-scanner
%__ln_s %{_initrddir}/openvas-scanner %{buildroot}%{_sbindir}/rcopenvas-scanner
%__install -Dm 0644 %{_sourcedir}/debian.openvas-scanner.default %{buildroot}%{_var}/adm/fillup-templates/sysconfig.openvas-scanner
%endif
%if 0%{?fedora_version} || 0%{?scientificlinux_version} || 0%{?centos_version}
%__install -Dm 0755 %{_sourcedir}/openvassd.init.fedora %{buildroot}%{_initrddir}/openvas-scanner
%__install -Dm 0644 %{_sourcedir}/debian.openvas-scanner.default %{buildroot}%{_sysconfdir}/sysconfig/openvas-scanner
%endif
%if 0%{?mandriva_version}
%__install -Dm 0755 %{_sourcedir}/openvassd.init.mandriva %{buildroot}%{_initrddir}/openvas-scanner
%__install -Dm 0644 %{_sourcedir}/debian.openvas-scanner.default %{buildroot}%{_sysconfdir}/sysconfig/openvas-scanner
%endif
%__mkdir_p %{buildroot}%{_localstatedir}/cache/openvas
%__mkdir_p %{buildroot}%{_localstatedir}/lib/openvas
%__mkdir_p %{buildroot}%{_localstatedir}/log/openvas
touch %{buildroot}%{_localstatedir}/log/openvas/greenbone-nvt-sync.log
touch %{buildroot}%{_localstatedir}/log/openvas/openvassd.dump
touch %{buildroot}%{_localstatedir}/log/openvas/openvassd.messages
%clean
test "%{buildroot}" != "/" && %__rm -rf %{buildroot}
%post
# Generate cert
if [ ! -f %{_localstatedir}/lib/openvas/CA/servercert.pem ] ; then
%{_sbindir}/openvas-mkcert -q > /dev/null 2>&1
fi
%if 0%{?suse_version}
%fillup_and_insserv openvas-scanner
%endif
%if 0%{?mandriva_version}
%_post_service openvas-scanner
%endif
%if 0%{?fedora_version} || 0%{?scientificlinux_version} || 0%{?centos_version}
# only rpm -i (not rpm {-U|-F})
if [ $1 = 1 ]; then
/sbin/chkconfig --add openvas-scanner
fi
%endif
%preun
%if 0%{?suse_version}
%stop_on_removal openvas-scanner
%endif
%if 0%{?mandriva_version}
%_preun_service openvas-scanner
%endif
%if 0%{?fedora_version} || 0%{?scientificlinux_version} || 0%{?centos_version}
# only rpm -e (not rpm {-U|-F})
if [ $1 = 0 ]; then
/sbin/service openvas-scanner stop > /dev/null 2>&1 || :
/sbin/chkconfig --del openvas-scanner
fi
%endif
%postun
%if 0%{?suse_version}
%restart_on_update openvas-scanner
%insserv_cleanup
%endif
%if 0%{?fedora_version} || 0%{?scientificlinux_version} || 0%{?centos_version}
# only rpm {-U|-F} (not rpm -e)
if [ $1 = 1 ]; then
/sbin/service openvas-scanner condrestart
fi
%endif
%files
%defattr(-,root,root)
%doc CHANGES COPYING ChangeLog README
%config(noreplace) %{_sysconfdir}/logrotate.d/openvas-scanner
%{_initrddir}/openvas-scanner
%{_sbindir}/greenbone-nvt-sync
%{_sbindir}/openvas-adduser
%{_sbindir}/openvas-mkcert
%{_sbindir}/openvas-mkcert-client
%{_sbindir}/openvas-nvt-sync
%{_sbindir}/openvas-rmuser
%{_sbindir}/openvassd
%{_mandir}/man8/greenbone-nvt-sync.8*
%{_mandir}/man8/openvas-adduser.8*
%{_mandir}/man8/openvas-mkcert.8*
%{_mandir}/man8/openvas-nvt-sync.8*
%{_mandir}/man8/openvas-rmuser.8*
%{_mandir}/man8/openvassd.8*
%ghost %{_localstatedir}/cache/openvas
%ghost %{_localstatedir}/lib/openvas
%dir %{_localstatedir}/log/openvas
%ghost %{_localstatedir}/log/openvas/greenbone-nvt-sync.log
%ghost %{_localstatedir}/log/openvas/openvassd.dump
%ghost %{_localstatedir}/log/openvas/openvassd.messages
%if 0%{?suse_version}
%{_sbindir}/rcopenvas-scanner
%{_var}/adm/fillup-templates/sysconfig.openvas-scanner
%else
%config(noreplace) %{_sysconfdir}/sysconfig/openvas-scanner
%endif