Blob Blame History Raw
%global         short_name gsad

#Name not same as upstream package to match the naming convention of the OpenVAS suite
Name:           openvas-gsa
Version:        7.0.3
Release:        2%{?dist}
Summary:        Greenbone Security Assistant (GSA) is GUI to the OpenVAS

License:        GPLv2+
URL:            http://www.openvas.org
Source0:        https://github.com/greenbone/gsa/archive/v%{version}.tar.gz
Source2:        %{name}.logrotate
Source3:        %{name}.sysconfig

%if 0%{?rhel} >= 7 || 0%{?fedora} > 15
Source4:        %{name}.service
%else
Source1:        %{name}.initd
%endif


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


BuildRequires:  gcc
BuildRequires:  openvas-libraries-devel >= 7.0
BuildRequires:  cmake >= 2.6.0
BuildRequires:  glib2-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libxslt-devel
BuildRequires:  libmicrohttpd-devel
BuildRequires:  doxygen
BuildRequires:  xmltoman
BuildRequires:  gpgme-devel
BuildRequires:  gettext
BuildRequires:  python3
BuildRequires:  python3-polib

Requires:       logrotate
Requires:       texlive-changepage
Requires:       texlive-comment

%if 0%{?rhel} >= 7 || 0%{?fedora} > 15
BuildRequires:          systemd
Requires(post):         systemd
Requires(preun):        systemd
Requires(postun):       systemd
%else
Requires(post):         chkconfig
Requires(preun):        chkconfig
Requires(preun):        initscripts
%endif


%description
The Greenbone Security Assistant (GSA) is a lean web service offering a user
web interface for the Open Vulnerability Assessment System (OpenVAS).
The GSA uses XSL transformation style-sheets that converts OMP responses
from the OpenVAS infrastructure into presentable HTML.

%prep
%setup -q -n gsa-%{version}
%patch1 -p1 -b .pki
#Fix encoding issues
iconv -f Windows-1250 -t utf-8 < CHANGES > CHANGES.utf8
touch -r CHANGES CHANGES.utf8
mv CHANGES.utf8 CHANGES
#iconv -f Windows-1250 -t utf-8 < ChangeLog > ChangeLog.utf8
#touch -r ChangeLog ChangeLog.utf8
#mv ChangeLog.utf8 ChangeLog


%build
export CFLAGS="$RPM_OPT_FLAGS -Werror=unused-but-set-variable -lgpg-error -Wno-error=deprecated-declarations"
%cmake -DLOCALSTATEDIR:PATH=%{_var} -DSYSCONFDIR:PATH=/etc/
make %{?_smp_mflags} VERBOSE=1

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

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

# Log directory
mkdir -p %{buildroot}/%{_var}/log/openvas
touch %{buildroot}%{_var}/log/openvas/%{name}.log

# 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}

%if 0%{?rhel} >= 7 || 0%{?fedora} > 15
# Install systemd
install -Dp -m 644 %{SOURCE4} %{buildroot}/%{_unitdir}/%{name}.service
%else
# Install startup script
install -Dp -m 755 %{SOURCE1} %{buildroot}/%{_initddir}/%{name}
%endif

#%find_lang gsad_xsl

%if 0%{?rhel} >= 7 || 0%{?fedora} > 15
%post
%systemd_post %{name}.service

%preun
%systemd_preun %{name}.service

%postun
%systemd_postun_with_restart %{name}.service

%else
#Post scripts for systemv initd
%post
# This adds the proper /etc/rc*.d links for the script
if [ "$1" -eq 1 ] ; then
        /sbin/chkconfig --add openvas-gsa
fi

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

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



%files
%{!?_licensedir:%global license %%doc}
%license COPYING
%doc CHANGES README
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/openvas/%{short_name}_log.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %{_sysconfdir}/openvas
%dir %{_datadir}/openvas
%dir %{_datadir}/openvas/gsa
%dir %{_var}/log/openvas
%{_sbindir}/%{short_name}
%{_mandir}/man8/%{short_name}.8*
%{_datadir}/openvas/gsa/
%dir %{_localstatedir}/log/openvas/
%ghost %{_localstatedir}/log/openvas/%{name}.log


%if 0%{?rhel} >= 7 || 0%{?fedora} > 15
%{_unitdir}/%{name}.service
%else
%{_initrddir}/%{name}
%endif


%changelog
* Fri Jan 17 2019 josef radinger <cheese@nosuchhost.net> - 7.0.3-2
- switch to python3 explicitly in buildrequires

* Fri Jan 11 2019 josef radinger <cheese@nosuchhost.net> - 7.0.3-1
- bump version
- new openvas-libraries
- new source-url
- no more Changelog
- cleanup specfile

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 7.0.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Mon Mar 19 2018 Iryna Shcherbina <ishcherb@redhat.com> - 7.0.2-6
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 7.0.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.0.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Wed Jul 05 2017 Michal Ambroz <rebus at, seznam.cz> - 7.0.2-2
- fix build dependencies to include python for po files

* Sun Apr 23 2017 Michal Ambroz <rebus at, seznam.cz> - 7.0.2-1
- bump to OpenVas-9 version 7.0.2

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 6.0.11-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Sep 05 2016 Michal Ambroz <rebus at, seznam.cz> - 6.0.11-1
- bump to OpenVas-8 version 6.0.11

* Fri Apr 29 2016 Michal Ambroz <rebus at, seznam.cz> - 6.0.10-3
- sync releases

* Fri Apr 29 2016 Michal Ambroz <rebus at, seznam.cz> - 6.0.10-1
- bump to OpenVas-8 version 6.0.10

* Thu Feb 25 2016 Michal Ambroz <rebus at, seznam.cz> - 6.0.9-4
- added compatibility definition for EPEL7 MHD version <= 0.9.33

* Thu Feb 25 2016 Michal Ambroz <rebus at, seznam.cz> - 6.0.9-3
- patch obsolete libmicrohttpd API for MHD_HTTP_METHOD_NOT_ACCEPTABLE 

* Wed Feb 24 2016 Michal Ambroz <rebus at, seznam.cz> - 6.0.9-2
- patch obsolete libmicrohttpd API for MHD_create_response_from_data

* Tue Feb 23 2016 Michal Ambroz <rebus at, seznam.cz> - 6.0.9-1
- bump to OpenVas-8 version 6.0.9

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 6.0.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Nov 05 2015 Kalev Lember <klember@redhat.com> - 6.0.6-3
- Rebuilt for libmicrohttpd soname bump

* Sun Oct 04 2015 josef radinger <cheese@nosuchhost.net> - 6.0.6-2
- add Requires on texlive-comment and texlive-changepage

* Tue Sep 29 2015 josef radinger <cheese@nosuchhost.net> - 6.0.6-1
- bump version

* Sat Aug 22 2015 Michal Ambroz <rebus at, seznam.cz> - 6.0.5-1
- bump to OpenVas-8 version 6.0.5
- 1254456 - fix logrotate script

* Wed Jul 15 2015 Michal Ambroz <rebus at, seznam.cz> - 6.0.4-1
- bump to OpenVas-8 version 6.0.4

* Wed Jun 24 2015 Michal Ambroz <rebus at, seznam.cz> - 6.0.3-4
- import to Fedora repository

* Wed Jun 17 2015 Michal Ambroz <rebus at, seznam.cz> - 6.0.3-3
- changes from package review

* Wed Jun 17 2015 Michal Ambroz <rebus at, seznam.cz> - 6.0.3-1
- bump to OpenVas-8 version 6.0.3

* Tue Nov 04 2014 Michal Ambroz <rebus at, seznam.cz> - 5.0.4-2
- remove sysvinit support
- add setgroups patch as noted by the rpmlint
- fixed encoding problems for the changelogs
- marked logrotate script as config

* Tue Nov 04 2014 Michal Ambroz <rebus at, seznam.cz> - 5.0.4-1
- bump to OpenVas-7 version 5.0.4

* Tue Sep 16 2014 Michal Ambroz <rebus at, seznam.cz> - 5.0.3-1
- bump to OpenVas-7 version 5.0.3

* Tue Sep 02 2014 Michal Ambroz <rebus at, seznam.cz> - 5.0.2-1
- bump to OpenVas-7 version 5.0.2

* Tue Jun 17 2014 Michal Ambroz <rebus at, seznam.cz> - 5.0.1-1
- initial build of OpenVas-7 version 5.0.1