Blob Blame History Raw
%define         tar_version 4.0+beta5

Name:		openvas-manager
Summary:	Manager Module for the Open Vulnerability Assessment System (OpenVAS)
Version:	4.0
Release:	3.beta5%{?dist}
URL:		http://www.openvas.org
License:	GPLv2+
Group:		System Environment/Libraries

#Source0:	http://wald.intevation.org/frs/download.php/1260/%{name}-%{version}.tar.gz
Source0:	http://wald.intevation.org/frs/download.php/1260/%{name}-%{tar_version}.tar.gz
Source1:	openvas-manager.initd
Source2:	openvas-manager.logrotate
Source3:	openvas-manager.sysconfig
Source4:	openvas-manager.service

#Patch to avoid compile-time errors about variable set but not used
Patch0:		openvas-manager-notused.patch

#Put certs to /etc/pki as suggested by http://fedoraproject.org/wiki/PackagingDrafts/Certificates
#Not reported upstream as it is RedHat/Fedora specific
Patch1:		openvas-manager-pki.patch

Patch2:		openvas-manager-gpgerror.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:	openvas-libraries-devel
BuildRequires:	cmake >= 2.6.0
BuildRequires:	glib2-devel
BuildRequires:	sqlite-devel
BuildRequires:	gnutls-devel
BuildRequires:	libuuid-devel
BuildRequires:	libpcap-devel
BuildRequires:	libksba-devel
BuildRequires:	gpgme-devel
BuildRequires:	libgpg-error-devel
BuildRequires:	doxygen
BuildRequires:	pkgconfig
BuildRequires:	xmltoman
Requires:	logrotate
Requires:	/usr/bin/xsltproc


Requires(post):		systemd-units
Requires(preun):	systemd-units
Requires(postun):	systemd-units
# This is actually needed for the %triggerun script but Requires(triggerun)
# is not valid.  We can use %post because this particular %triggerun script
# should fire just after this package is installed.
Requires(post):		systemd-sysv


%description
The OpenVAS Manager is the central service that consolidates plain vulnerability
scanning into a full vulnerability management solution. The Manager controls the
Scanner via OTP and itself offers the XML-based, stateless OpenVAS Management 
Protocol (OMP). All intelligence is implemented in the Manager so that it is
possible to implement various lean clients that will behave consistently e.g. 
with regard to filtering or sorting scan results. The Manager also controls 
a SQL database (sqlite-based) where all configuration and scan result data is 
centrally stored.



%package sysvinit
Summary:		SysV style init script for %{name}
Group:			Documentation
Requires:		%{name} = %{version}-%{release}
Requires(post):		chkconfig
Requires(preun):	chkconfig
Requires(preun):	initscripts

%description sysvinit
SysV style init script for %{name}.
It needs to be installed only if systemd is not used as the system init process.



%prep
#%setup -q
%setup -q -n %{name}-%{tar_version}
#%patch0 -p1 -b .notused
%patch1 -p1 -b .pki
%patch2 -p1 -b .gpgerror

%build
export CFLAGS="$RPM_OPT_FLAGS -Werror=unused-but-set-variable"
%cmake -DLOCALSTATEDIR:PATH=%{_var}
make %{?_smp_mflags} VERBOSE=1

%install
rm -rf %{buildroot}

make install DESTDIR=%{buildroot} INSTALL="install -p"

#Config directory
mkdir -p %{buildroot}/%{_sysconfdir}/openvas
chmod 755 %{buildroot}/%{_sysconfdir}/openvas

#Log direcotry
mkdir -p %{buildroot}/%{_var}/log/openvas
touch %{buildroot}%{_var}/log/openvas/openvasmd.log

#Runtime lib directory
mkdir -p %{buildroot}/%{_var}/lib/openvas/mgr

# Install startup script
install -Dp -m 755 %{SOURCE1} %{buildroot}/%{_initddir}/%{name}

# Install systemd
install -Dp -m 644 %{SOURCE4} %{buildroot}/%{_unitdir}/%{name}.service


# install log rotation stuff
install -m 644 -Dp %{SOURCE2} \
	%{buildroot}/%{_sysconfdir}/logrotate.d/%{name}

# Install sysconfig configration
install -Dp -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}

#Fix permissions on templates
chmod -R a+r %{buildroot}%{_datadir}/openvas/openvasmd
find %{buildroot}%{_datadir}/openvas/openvasmd -name generate | xargs chmod 755

#Clean installed doc directory
rm -rf %{buildroot}%{_datadir}/doc/%{name}


%clean
[ "%{buildroot}" = "/" ] || rm -rf %{buildroot}


%post
%systemd_post openvas-manager.service

%preun
%systemd_preun openvas-manager.service

%postun
%systemd_postun_with_restart openvas-manager.service

%triggerun -- openvas-manager < 2.0.4-3
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply openvas-manager
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save openvas-manager >/dev/null 2>&1 ||:

# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del openvas-manager >/dev/null 2>&1 || :
/bin/systemctl try-restart openvas-manager.service >/dev/null 2>&1 || :



%post sysvinit
# This adds the proper /etc/rc*.d links for the script
if [ "$1" -eq 1 ] ; then
	/sbin/chkconfig --add openvas-manager
fi


%preun sysvinit
if [ "$1" -eq 0 ] ; then
	/sbin/service openvas-manager stop >/dev/null 2>&1
	/sbin/chkconfig --del openvas-manager
fi


%postun sysvinit
# only for upgrades not erasure
if [ "$1" -eq 1 ] ; then
	/sbin/service openvas-manager condrestart  >/dev/null 2>&1
fi


%files
%defattr(-,root,root)
#INSTALL file contains post-installation guide for whole openvas
%doc CHANGES COPYING README ChangeLog TODO INSTALL
%doc doc/*.png doc/*.sql doc/*.html doc/report-format-HOWTO doc/about-cert-feed.txt
%doc report_formats
%config(noreplace) %{_sysconfdir}/logrotate.d/openvas-manager
%dir %{_sysconfdir}/openvas
%dir %{_var}/lib/openvas
%dir %{_var}/lib/openvas/mgr
%dir %{_var}/log/openvas
%dir %{_datadir}/openvas
%dir %{_datadir}/openvas/scap
%dir %{_datadir}/openvas/cert

%config(noreplace) %{_sysconfdir}/openvas/openvasmd_log.conf
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%{_unitdir}/%{name}.service
%{_sbindir}/openvasmd
%{_sbindir}/greenbone-scapdata-sync
%{_sbindir}/openvas-scapdata-sync
%{_sbindir}/openvas-certdata-sync
%{_mandir}/man8/openvasmd.8*
%{_datadir}/openvas/openvasmd
%{_datadir}/openvas/scap/*
%{_datadir}/openvas/cert/*
%ghost %{_var}/log/openvas/openvasmd.log


%files sysvinit
%defattr(-,root,root)
%{_initrddir}/%{name}


%changelog
* Tue Mar 12 2013 Michal Ambroz <rebus at, seznam.cz> - 4.0-3.beta5
- bump to OpenVas-6 version 4.0+beta5

* Tue Mar 12 2013 Michal Ambroz <rebus at, seznam.cz> - 4.0-2.beta4
- rebuilt with new GnuTLS

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0-1.beta4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Wed Feb 06 2013 Michal Ambroz <rebus at, seznam.cz> - 4.0-0.beta4
- bump to OpenVas-6 version 4.0+beta4

* Fri Oct 15 2012 Michal Ambroz <rebus at, seznam.cz> - 3.0.4-1
- bump OpenVas-5 (openvas-manager 3.0.4)

* Sat Aug 25 2012 Michal Ambroz <rebus at, seznam.cz> - 2.0.5-1
- bugfix release
- changed post scriptlets to macros for Fedora 18+

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Mon Apr 10 2012 Michal Ambroz <rebus at, seznam.cz> - 2.0.4-3
- migrate init scripts from sysvinit to systemd

* Mon Jan 23 2012 Michal Ambroz <rebus at, seznam.cz> - 2.0.4-2
- fix checking for the existence of the certificates in initscript

* Mon Jan 09 2012 Michal Ambroz <rebus at, seznam.cz> - 2.0.4-1
- new upstream version 2.0.4

* Wed Apr 06 2011 Michal Ambroz <rebus at, seznam.cz> - 2.0.2-4
- dependencies for F15

* Wed Mar 30 2011 Michal Ambroz <rebus at, seznam.cz> - 2.0.2-3
- implement changes based on package review

* Wed Mar 30 2011 Michal Ambroz <rebus at, seznam.cz> - 2.0.2-2
- implement changes based on package review

* Mon Mar 28 2011 Michal Ambroz <rebus at, seznam.cz> - 2.0.2-1
- initial spec for openvas-manager based on openvas-scanner