File grafana-apache.spec of Package grafana-apache
#
# spec file for package grafana-apache
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright 2017 Fujitsu LIMITED
#
# 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/
#
%define apache_root /srv/www/
%define apache_cfg_dir %{_sysconfdir}/apache2/vhosts.d/
%define app_name grafana
Name: grafana-apache
Version: 0.0.2+git.1497453687.be06ddf
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: https://github.com/FujitsuEnablingSoftwareTechnologyGmbH
Summary: RPM package to deploy Grafana 1 with Apache Server
License: Apache-2.0
Group: Monitoring/Tools
Source0: grafana-apache.tar.gz
Source1: %{name}.conf
Source2: %{name}-rpmlintrc
BuildRequires: apache2
Requires: apache2
BuildArch: noarch
%description
Following package will deploy Grafana 1 to Apache Server.
Note that this package requires Apache to be installed and it is meant for Apache only.
%prep
# no-op
%setup -n grafana-master
%build
# no-op
%install
## copy sources
install -d -m 755 %{buildroot}%{apache_root}%{app_name}
cp -a src/* %{buildroot}/%{apache_root}/%{app_name}
## copy conf
install -D -m 644 %{S:1} %{buildroot}%{apache_cfg_dir}%{app_name}.conf.sample
# remove the diractory where we unpacked
rm -rf %{buildroot}/%{app_name}
# remove all tests from target
find %{buildroot}%{apache_root}%{app_name} -type d -name '*test*' | xargs -0 rm -rf
%pre
# no-op
%post
# no-op
%preun
# no-op
%postun
# no-op
%files
%defattr(-,root,root)
%doc LICENSE.md
%dir %{apache_root}%{app_name}
%dir %{apache_root}%{app_name}/*
%attr(0770, root, www) %{apache_root}%{app_name}/*
%config(noreplace) %{apache_cfg_dir}%{app_name}.conf.sample
%changelog