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/
#
# norootforbuild
Name: openvas-scanner
Version: 3.0.2
Release: 6.<RELEASE2>
License: GNU 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
Source6: openvassd.conf
Patch0: openvas-scanner-3.0.2-MKTEMP.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
BuildRequires: libgpgme-devel
PreReq: %insserv_prereq
PreReq: %fillup_prereq openssl
%endif
%if 0%{?mandriva_version}
BuildRequires: gpgme-devel
%if 0%{?mandriva_version} == 2009
BuildRequires: pinentry-gtk
%endif
%if 0%{?mandriva_version} > 200900
BuildRequires: pinentry-gtk2
%endif
%endif
%if 0%{?fedora_version}
BuildRequires: gpgme-devel
%endif
BuildRequires: glib2-devel
BuildRequires: gnutls-devel >= 2.0.3
BuildRequires: libopenvas-devel >= 3.0.0
BuildRequires: libpcap-devel
Requires: logrotate
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
# Otherwise the .nes plugins don't get build
aclocal
%__autoconf
%endif
#prevent the key generation script from putting the keys in /usr/com (sharedstatedir default)
%configure --sharedstatedir=%{_localstatedir}/lib --enable-syslog
%__make %{?_smp_mflags}
%install
%__make install DESTDIR=%{buildroot}
%__install -Dm 0644 %{_sourcedir}/openvassd.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/openvas-scanner
%__install -Dm 0644 %{_sourcedir}/openvassd.conf %{buildroot}%{_sysconfdir}/openvas/
%__sed -i -e "s|/usr/lib/openvas/plugins|%{_libdir}/openvas/plugins|g" %{buildroot}%{_sysconfdir}/openvas/openvassd.conf
%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}
%__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}/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}
# 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}
# 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}
# 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
%dir %{_sysconfdir}/openvas
%dir %{_sysconfdir}/openvas/gnupg
%config(noreplace) %{_sysconfdir}/openvas/openvassd.conf
%{_initrddir}/openvas-scanner
%{_bindir}/openvas-mkcert-client
%{_bindir}/openvas-mkrand
%{_sbindir}/greenbone-nvt-sync
%{_sbindir}/openvas-adduser
%{_sbindir}/openvas-mkcert
%{_sbindir}/openvas-nvt-sync
%{_sbindir}/openvas-rmuser
%{_sbindir}/openvassd
%dir %{_libdir}/openvas
%{_libdir}/openvas/plugins
%{_mandir}/man1/openvas-mkcert-client.1*
%{_mandir}/man1/openvas-mkrand.1*
%{_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*
%dir %{_localstatedir}/cache/openvas
%{_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
%changelog