File greenbone-security-assistant.spec of Package greenbone-security-assistant

# spec file for package greenbone-security-assistant
#
# Copyright (c) 2013 Johann LUCE.
#
# 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/
#

%if 0%{?suse_version} > 1230
%bcond_without systemd
%else
%bcond_with    systemd
%endif

Name:           greenbone-security-assistant
Version:        6.0.11
Release:        0
License:        GPL-2.0
Group:          Productivity/Networking/Security
URL:            http://www.openvas.org
Source0:        %{name}-%{version}.tar.gz
Source1:        gsad.logrotate
Source2:        debian.greenbone-security-assistant.default
Source3:        gsad.init.suse
Source4:        gsad.init.fedora
Source5:        gsad.init.mandriva
Source6:	greenbone-security-assistant.service
#Patch1:		greenbone-security-gcrypt_version.patch	
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%if 0%{?mandriva_version}
BuildRequires:  pinentry-gtk2
%if 0%{?mandriva_version} < 201000
BuildRequires:  libxslt-proc
%else
BuildRequires:  xsltproc
%endif
%endif

%if 0%{?suse_version}
BuildRequires:  fdupes
PreReq:         %insserv_prereq
PreReq:         %fillup_prereq
%if %{with systemd}
BuildRequires:  systemd
%systemd_requires
%endif
%endif

BuildRequires:  cmake >= 2.6.0
BuildRequires:  doxygen
BuildRequires:  glib2-devel
BuildRequires:  libmicrohttpd-devel
BuildRequires:  libopenvas-devel >= 8.0.0
BuildRequires:  libxslt-devel
BuildRequires:  pkgconfig
Requires:       logrotate
Summary:        The Greenbone Security Assistant

%description
The Greenbone Security Assistant is a web application that
connects to the OpenVAS Manager and OpenVAS Administrator
to provide for a full-featured user interface for
vulnerability management.


%prep
%setup -q
%if 0%{?suse_version}
#%patch1 -p1
%endif

%build
%if 0%{?mandriva_version}
%serverbuild
%endif
%cmake -DLOCALSTATEDIR=%{_localstatedir} -DSYSCONFDIR=%{_sysconfdir}
%__make %{?_smp_mflags} VERBOSE=1

%install
%cmake_install
%__install -D -m 644 %{_sourcedir}/gsad.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/greenbone-security-assistant

%if 0%{?suse_version}
%if %{with systemd}
install -D -m 644 $RPM_SOURCE_DIR/greenbone-security-assistant.service $RPM_BUILD_ROOT%{_unitdir}/greenbone-security-assistant.service
%__ln_s %{_sbindir}/service %{buildroot}%{_sbindir}/rcgreenbone-security-assistant
%else
%__install -D -m 755 %{_sourcedir}/gsad.init.suse %{buildroot}%{_initrddir}/greenbone-security-assistant
%__ln_s %{_initrddir}/greenbone-security-assistant %{buildroot}%{_sbindir}/rcgreenbone-security-assistant
%endif
%__install -D -m 644 %{_sourcedir}/debian.greenbone-security-assistant.default %{buildroot}%{_var}/adm/fillup-templates/sysconfig.greenbone-security-assistant
%fdupes %{buildroot}%{_datadir}/openvas/
%endif

%if 0%{?fedora_version} || 0%{?scientificlinux_version}
%__install -D -m 755 %{_sourcedir}/gsad.init.fedora %{buildroot}%{_initrddir}/greenbone-security-assistant
%__install -D -m 644 %{_sourcedir}/debian.greenbone-security-assistant.default %{buildroot}%{_sysconfdir}/sysconfig/greenbone-security-assistant
%endif

%if 0%{?mandriva_version}
%__install -D -m 755 %{_sourcedir}/gsad.init.mandriva %{buildroot}%{_initrddir}/greenbone-security-assistant
%__install -D -m 644 %{_sourcedir}/debian.greenbone-security-assistant.default %{buildroot}%{_sysconfdir}/sysconfig/greenbone-security-assistant
%endif

%__mkdir_p %{buildroot}%{_localstatedir}/log/openvas
touch %{buildroot}%{_localstatedir}/log/openvas/gsad.log
%find_lang gsad_xsl


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

%pre
%if %{with systemd}
%service_add_pre greenbone-security-assistant.service
%endif

%post
%if 0%{?suse_version}
%fillup_only greenbone-security-assistant
%if %{with systemd}
%service_add_post greenbone-security-assistant.service
%endif
%endif

%if 0%{?mandriva_version}
%_post_service greenbone-security-assistant
%endif

%if 0%{?fedora_version} || 0%{?scientificlinux_version}
# only rpm -i (not rpm {-U|-F})
if [ $1 = 1 ]; then
	/sbin/chkconfig --add greenbone-security-assistant
fi
%endif

%preun
%if 0%{?suse_version}
%if %{with systemd}
%service_del_preun greenbone-security-assistant.service
%else
%stop_on_removal greenbone-security-assistant
%endif
%endif

%if 0%{?mandriva_version}
%_preun_service greenbone-security-assistant
%endif

%if 0%{?fedora_version} || 0%{?scientificlinux_version}
# only rpm -e (not rpm {-U|-F})
if [ $1 = 0 ]; then
    /sbin/service greenbone-security-assistant stop > /dev/null 2>&1 || :
    /sbin/chkconfig --del greenbone-security-assistant
fi
%endif

%postun
%if 0%{?suse_version}
%if %{with systemd}
%service_del_postun greenbone-security-assistant.service
%else
%restart_on_update greenbone-security-assistant
%insserv_cleanup
%endif
%endif

%if 0%{?fedora_version} || 0%{?scientificlinux_version}
# only rpm {-U|-F} (not rpm -e)
if [ $1 = 1 ]; then
    /sbin/service greenbone-security-assistant condrestart
fi
%endif

%files -f gsad_xsl.lang
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/logrotate.d/greenbone-security-assistant
%dir %{_sysconfdir}/openvas
%config(noreplace) %{_sysconfdir}/openvas/gsad_log.conf
%{_sbindir}/gsad
%{_mandir}/man8/gsad.8*
%dir %{_datadir}/openvas
%{_datadir}/openvas/gsa
%dir %{_localstatedir}/log/openvas
%ghost %{_localstatedir}/log/openvas/gsad.log

%if 0%{?suse_version}
%{_sbindir}/rcgreenbone-security-assistant
%{_var}/adm/fillup-templates/sysconfig.greenbone-security-assistant
%else
%config(noreplace) %{_sysconfdir}/sysconfig/greenbone-security-assistant
%endif
%if %{with systemd}
%{_unitdir}/greenbone-security-assistant.service
%else
%{_initrddir}/greenbone-security-assistant
%endif

%changelog
openSUSE Build Service is sponsored by