File openvas-administrator.spec of Package openvas-administrator

#
# spec file for package openvas-administrator
#
# 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-administrator
Version:        1.1.1
Release:        2
License:        GPLv2+
Group:          Productivity/Networking/Security
Url:            http://www.openvas.org
Source0:        %{name}-%{version}.tar.gz
Source1:        openvasad.logrotate
Source2:        debian.openvas-administrator.default
Source3:        openvasad.init.suse
Source4:        openvasad.init.fedora
Source5:        openvasad.init.mandriva
Patch0:         openvas-administrator-1.1.1-out_of_source_build.patch
Patch1:         openvas-admin-add-needed.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%if 0%{?mandriva_version}
BuildRequires:  pinentry-gtk2
%endif

BuildRequires:  cmake >= 2.6.0
BuildRequires:  doxygen
BuildRequires:  glib2-devel
BuildRequires:  libopenvas-devel >= 3.0.0
BuildRequires:  pkgconfig
BuildRequires:  libgcrypt-devel
Requires:       logrotate
Summary:        Administrator Module of OpenVAS

%description
This is the administrator module for the Open Vulnerability Assessment 
System (OpenVAS). It is intended to simplify the configuration and 
administration of an OpenVAS server both on a local installation as 
well as on a remote system.


%prep
%setup -q
%patch0
%patch1

%build
%if 0%{?mandriva_version}
%serverbuild
%endif

export CFLAGS="$RPM_OPT_FLAGS"

%__mkdir build
cd build
cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON \
        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
        -DSYSCONFDIR=%{_sysconfdir} \
        -DLOCALSTATEDIR=%{_localstatedir} \
        -DCMAKE_BUILD_TYPE=release

%__make %{?_smp_mflags} VERBOSE=1
#%__make %{?_smp_mflags} doc

%install
cd build
%__make install DESTDIR=%{buildroot}
%__install -D -m 644 %{_sourcedir}/openvasad.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/openvas-administrator

%if 0%{?suse_version}
%__install -D -m 744 %{_sourcedir}/openvasad.init.suse %{buildroot}%{_initrddir}/openvas-administrator
%__ln_s %{_initrddir}/openvas-administrator %{buildroot}%{_sbindir}/rcopenvas-administrator
%__install -D -m 644 %{_sourcedir}/debian.openvas-administrator.default %{buildroot}%{_var}/adm/fillup-templates/sysconfig.openvas-administrator
%endif

%if 0%{?fedora_version} || 0%{?scientificlinux_version} || 0%{?centos_version}
%__install -D -m 744 %{_sourcedir}/openvasad.init.fedora %{buildroot}%{_initrddir}/openvas-administrator
%__install -D -m 644 %{_sourcedir}/debian.openvas-administrator.default %{buildroot}%{_sysconfdir}/sysconfig/openvas-administrator
%endif

%if 0%{?mandriva_version}
%__install -D -m 744 %{_sourcedir}/openvasad.init.mandriva %{buildroot}%{_initrddir}/openvas-administrator
%__install -D -m 644 %{_sourcedir}/debian.openvas-administrator.default %{buildroot}%{_sysconfdir}/sysconfig/openvas-administrator
%endif

%__mkdir_p %{buildroot}%{_localstatedir}/log/openvas
touch %{buildroot}%{_localstatedir}/log/openvas/openvasad.log

%clean
test "%{buildroot}" != "/" && %__rm -rf %{buildroot}

%post
%if 0%{?suse_version}
%fillup_and_insserv openvas-administrator
%endif

%if 0%{?mandriva_version}
%_post_service openvas-administrator
%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-administrator
fi
%endif

%preun
%if 0%{?suse_version}
%stop_on_removal openvas-administrator
%endif

%if 0%{?mandriva_version}
%_preun_service openvas-administrator
%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-administrator stop > /dev/null 2>&1 || :
    /sbin/chkconfig --del openvas-administrator
fi
%endif

%postun
%if 0%{?suse_version}
%restart_on_update openvas-administrator
%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-administrator condrestart
fi
%endif

%files
%defattr(-,root,root)
%doc CHANGES
%config(noreplace) %{_sysconfdir}/logrotate.d/openvas-administrator
%dir %{_sysconfdir}/openvas
%config(noreplace) %{_sysconfdir}/openvas/openvasad_log.conf
%{_initrddir}/openvas-administrator
%{_sbindir}/openvasad
%{_mandir}/man8/openvasad.8*
%{_datadir}/openvas/openvasad
%dir %{_localstatedir}/log/openvas
%ghost %{_localstatedir}/log/openvas/openvasad.log

%if 0%{?suse_version}
%{_sbindir}/rcopenvas-administrator
%{_var}/adm/fillup-templates/sysconfig.openvas-administrator
%else
%config(noreplace) %{_sysconfdir}/sysconfig/openvas-administrator
%endif

%changelog
openSUSE Build Service is sponsored by