File cacti-plugin-weathermap.spec of Package cacti-plugin-weathermap

#
# spec file for package cacti-plugin-weathermap
#
# Copyright (c) 2013 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/
#


Name:           cacti-plugin-weathermap
Version:        0.98
Release:        0.0
Summary:        Weathermap is a network visualisation tool
License:        GPL-2.0
Group:          Development/Tools/Other
Url:            http://www.network-weathermap.com
Source0:        php-%{realname}-%{version}.zip
# PATCH-FIX-UPSTREAM weathermap_sql_text_default.patch
#Patch0:         weathermap_sql_text_default.patch
BuildRequires:  dos2unix
BuildRequires:  unzip
Requires:       cacti
Requires:       php-gd
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%define realname   weathermap
%if 0%{?suse_version} <= 1210
%define prefix %{_datadir}/cacti
%else
%define prefix /srv/www/cacti
%endif
Obsoletes:      cacti-PA-weathermap
Provides:       cacti-PA-weathermap

%description
Weathermap is a network visualisation tool, to take data you already have and show you an overview of your network in map form.
Support is built in for RRD, MRTG (RRD and old log-format), and tab-delimited text files. Other sources are via plugins or external scripts.

%package doc
Summary:        Weathermap is a network visualisation tool
Group:          System/Libraries

%description doc
Weathermap is a network visualisation tool, to take data you already have and show you an overview of your network in map form.
Support is built in for RRD, MRTG (RRD and old log-format), and tab-delimited text files. Other sources are via plugins or external scripts.

%prep
%setup -q  -n %{realname}
#%patch0 -p1
# Correct the file rights
find . -type f ! \( -name "*.pl" -o -name weathermap -o -name query_weathermap_runtime.php \) -exec chmod -x {} \;
# Change file format from dos to unix
dos2unix overlib.js
dos2unix docs/example/overlib.js

%build

%install
%if 0%{?suse_version} < 1310
sed -i 's|/usr/bin/php|/usr/bin/php5|' weathermap
%endif
mkdir -p %{buildroot}%{prefix}/plugins/%{realname}
cp -r * %{buildroot}%{prefix}/plugins/%{realname}/.
mkdir -p %{buildroot}%{_docdir}/cacti/plugins/%{realname}
mv %{buildroot}%{prefix}/plugins/%{realname}/docs/* %{buildroot}%{_docdir}/cacti/plugins/%{realname}/.
mv %{buildroot}%{prefix}/plugins/%{realname}/CHANGES %{buildroot}%{_docdir}/cacti/plugins/%{realname}/.
mv %{buildroot}%{prefix}/plugins/%{realname}/COPYING %{buildroot}%{_docdir}/cacti/plugins/%{realname}/.
mv %{buildroot}%{prefix}/plugins/%{realname}/README.md %{buildroot}%{_docdir}/cacti/plugins/%{realname}/.
rmdir %{buildroot}%{prefix}/plugins/%{realname}/docs

%files
%defattr(-,root,root)
%{prefix}/
%attr(-,wwwrun,www) %{prefix}/plugins/%{realname}/configs
%attr(-,wwwrun,www) %{prefix}/plugins/%{realname}/output

%files doc
%defattr(-,root,root)
%dir %{_docdir}/cacti
%dir %{_docdir}/cacti/plugins
%{_docdir}/cacti/plugins/%{realname}/

%changelog
openSUSE Build Service is sponsored by