-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrafgrapher.spec
102 lines (86 loc) · 2.9 KB
/
trafgrapher.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# use python3 for Fedora
%if 0%{?fedora} || 0%{?rhel} > 7
%global PYTHON %{python3}
%global PYTHON_SITELIB %{python3_sitelib}
%else
%global PYTHON %{_bindir}/python2
%global PYTHON_SITELIB %{python2_sitelib}
%endif
Name: trafgrapher
Version: 3.4.0
Release: 0.beta14%{?dist}
Summary: Collect and display network/disk/storage transfers.
License: MIT
URL: https://www.salstar.sk/trafgrapher/
Source0: https://www.salstar.sk/pub/trafgrapher/trafgrapher-%{version}.tgz
BuildArch: noarch
%if 0%{?fedora} || 0%{?rhel} > 7
BuildRequires: python3-devel
%else
BuildRequires: python2-devel
%endif
# use distribution jquery
BuildRequires: js-jquery
Requires: js-jquery
%description
TrafGrapher is an javascript script to collect and display data.
It can read MRTG log files, or can collect it's own data.
Also useable to display SAN storage performance or Nagios performance data.
%prep
%setup -q
%build
mkdir web
ln -s network.html index.html
mv *.css *.html *.js flot web/
rm -f bin/tgc.py # remove client symlink
if [ -d /usr/share/javascript/jquery/latest ]; then
rm web/flot/jquery.js web/flot/jquery.min.js web/flot/jquery.min.map
ln -s ../../../javascript/jquery/latest/jquery.js web/flot/
ln -s ../../../javascript/jquery/latest/jquery.min.js web/flot/
ln -s ../../../javascript/jquery/latest/jquery.min.map web/flot/
fi
# update python version
sed -i 's|#!/usr/bin/python[23]|#!%{PYTHON}|' bin/*.py
%install
mkdir -p $RPM_BUILD_ROOT%{_bindir} $RPM_BUILD_ROOT%{_datadir}/%{name} \
$RPM_BUILD_ROOT%{PYTHON_SITELIB}
mv bin/trafgrapher.py $RPM_BUILD_ROOT%{PYTHON_SITELIB}/
ln -sr %{PYTHON_SITELIB}/%{name}.py $RPM_BUILD_ROOT%{_bindir}/tgc
cp -ar bin/* $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -ar web $RPM_BUILD_ROOT%{_datadir}/%{name}
ln -s ../share/%{name}/compellent.py $RPM_BUILD_ROOT%{_bindir}/tg_compellent
ln -s ../share/%{name}/process_perfdata.py $RPM_BUILD_ROOT%{_bindir}/tg_process_perfdata
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d
cat > $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/trafgrapher.conf << EOF
<Directory /usr/share/trafgrapher/web>
Options SymLinksifOwnerMatch
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
AllowOverride None
Order allow,deny
Allow from all
</IfModule>
</Directory>
Alias /trafgrapher %{_datadir}/%{name}/web
#Alias /trafgrapher/flot /usr/lib/node_modules/flot
EOF
%files
%defattr(-,root,root)
%doc README.md
%{!?_licensedir:%global license %%doc}
%license LICENSE.txt
%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/httpd/conf.d/trafgrapher.conf
%if 0%{?fedora} || 0%{?rhel} > 7
%pycached %{python3_sitelib}/%{name}.py
%else
%{python2_sitelib}/%{name}.py*
%endif
%{_bindir}/*
%{_datadir}/%{name}
%changelog
* Fri Apr 8 2016 Ján ONDREJ (SAL) <ondrejj(at)salstar.sk>
- initial release