/[nagraffiti]/nagraffiti.spec
ViewVC logotype

Contents of /nagraffiti.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (show annotations) (download)
Wed Dec 20 10:25:22 2017 UTC (7 months, 3 weeks ago) by racvision
File size: 6228 byte(s)
XH 201712
1 # release number:
2 %define rel %(date '+%Y%m%d%H%M')
3
4 %define wwwpath /var/www/html
5 %define nagraffiti_user nagraffiti
6
7 Summary: Nagios grapher
8 Name: nagraffiti
9 Version: 2.6
10 Release: %{rel}
11 Source0: %{name}-www.tar.bz2
12 Source1: %{name}-backend.tar.bz2
13 Source2: %{name}-po.tar.bz2
14 License: GPL
15 Group: Applications/System
16 Requires: rrdtool-perl, check_mk-livestatus, dejavu-sans-mono-fonts, perl-JSON-XS, nagraffiti-neb2json
17 Provides: perl(Nagraffiti::Nagraph)
18 BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
19 BuildArch: noarch
20
21 # mysql password path :
22 %define mysql_passwd_path %{_sysconfdir}/racvision/mysql/passwords
23
24
25 %description
26 Nagraffiti is a performance data grapher for Nagios. It use Livestatus and neb2json event broker to collect data.
27
28
29 %description -l fr
30 Nagraffiti est un traceur de donnée de performance issues de Nagios. Il utilise Livestatus et module neb2json pour collecter les données.
31
32 %prep
33
34 #%setup
35 %{__tar} --overwrite -xjf %{SOURCE0}
36 %{__tar} --overwrite -xjf %{SOURCE1}
37 %{__tar} --overwrite -xjf %{SOURCE2}
38
39 %build
40
41 %install
42 [ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && %{__rm} -rf $RPM_BUILD_ROOT;
43
44
45 # Racvision index info
46 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/racvision/
47 %{__install} -p -m0644 www/nagraffiti.php $RPM_BUILD_ROOT/%{wwwpath}/racvision/
48
49 # www files
50 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}/classes
51 %{__install} -p -m0644 www/classes/*.php $RPM_BUILD_ROOT/%{wwwpath}/%{name}/classes/
52
53 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}/css
54 %{__install} -p -m0644 www/css/*.css $RPM_BUILD_ROOT/%{wwwpath}/%{name}/css/
55 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}/css/jquery
56 %{__install} -p -m0644 www/css/jquery/*.css $RPM_BUILD_ROOT/%{wwwpath}/%{name}/css/jquery/
57 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}/css/jquery/images
58 %{__install} -p -m0644 www/css/jquery/images/*.png $RPM_BUILD_ROOT/%{wwwpath}/%{name}/css/jquery/images/
59
60 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}/img
61 %{__install} -p -m0644 www/img/* $RPM_BUILD_ROOT/%{wwwpath}/%{name}/img/
62
63 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}/js
64 %{__install} -p -m0644 www/js/*.js $RPM_BUILD_ROOT/%{wwwpath}/%{name}/js/
65 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}/js/jquery
66 %{__install} -p -m0644 www/js/jquery/*.js $RPM_BUILD_ROOT/%{wwwpath}/%{name}/js/jquery/
67
68 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}/%{name}
69 %{__install} -p -m0644 www/%{name}/*.php $RPM_BUILD_ROOT/%{wwwpath}/%{name}/%{name}/
70
71 %{__install} -p -m0644 www/index.php $RPM_BUILD_ROOT/%{wwwpath}/%{name}/
72
73 # Templates
74 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}/templates
75 %{__install} -p -m0644 www/templates/*.php $RPM_BUILD_ROOT/%{wwwpath}/%{name}/templates/
76
77 # backend
78 %{__install} -d $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti
79 %{__install} -p -m0755 backend/lib/*.pm $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti/
80 %{__install} -d $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti/Input
81 %{__install} -p -m0755 backend/lib/Input/*.pm $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti/Input
82
83 %{__install} -d $RPM_BUILD_ROOT/%{_bindir}
84 %{__install} -d $RPM_BUILD_ROOT/%{_sbindir}
85 #%{__install} -p -m0755 backend/nagraffiti-ndo-daemon.pl $RPM_BUILD_ROOT/%{_sbindir}/
86 %{__install} -p -m0755 backend/nagraffiti-daemon.pl $RPM_BUILD_ROOT/%{_sbindir}/
87 %{__install} -p -m0755 backend/cleanRrds.pl $RPM_BUILD_ROOT/%{_bindir}/
88
89 # Configs files:
90 %{__install} -d $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
91 %{__install} -d $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
92 %{__install} -p -m0640 backend/config.ini $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
93 %{__install} -p -m0644 backend/rra.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
94 %{__install} -p -m0644 backend/log4p.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
95 %{__install} -p -m0644 backend/%{name}.logrotate %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
96
97 # Logs files:
98 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/log/%{name}
99
100 # Rrd repository:
101 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}
102
103 # Pid
104 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/run/%{name}
105
106
107 # Init script
108 %{__install} -d $RPM_BUILD_ROOT/%{_initrddir}
109 %{__install} -p -m0755 backend/%{name}.init $RPM_BUILD_ROOT/%{_initrddir}/%{name}
110
111
112 # I18n files
113 for lang in fr; do
114 %{__install} -d $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/
115 %{__install} -m0644 po/init-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_init.mo
116 %{__install} -m0644 po/php-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_php.mo
117 done
118
119 %{find_lang} %{name}_init %{name}_lang --all-name
120
121
122 # TMPFS
123 %{__install} -d %{buildroot}%{_datadir}/nagios-tmpfs/perfdatas
124
125 #====[ pre installation scripts:
126 %pre
127
128 # Add user/group:
129 echo Adding %{nagraffiti_user} user ...
130 /usr/sbin/useradd -M -o -r -d %{_localstatedir}/log/%{name} -s /sbin/nologin -c "Application Nagraffiti" -u 407 %{nagraffiti_user} > /dev/null 2>&1 || :
131
132 # Add apache in nagraffiti group
133 if ! id -Gn apache | grep -q nagraffiti ; then
134 echo "Adding user 'apache' to 'nagraffiti' group."
135 usermod -aG nagraffiti apache
136 fi
137
138 #====[ post installation scripts:
139 %post
140
141 # Configure database password :
142 #/usr/bin/mkpasswd -l 10 -s 0 > %{mysql_passwd_path}/%{name}
143 #%{__chmod} 640 %{mysql_passwd_path}/%{name}
144
145 # Add initscript to system V start :
146 systemctl enable %{name}
147 systemctl start %{name}
148
149
150 #====[ pre uninstall scripts
151 %preun
152
153 %postun
154
155 %files -f %{name}_lang
156 %doc backend/README
157 %{_sysconfdir}/logrotate.d/nagraffiti
158 %defattr(-,%{nagraffiti_user},%{nagraffiti_user})
159 %config %{_sysconfdir}/%{name}/rra.cfg
160 %config %{_sysconfdir}/%{name}/log4p.cfg
161 %attr(-,%{nagraffiti_user} ,apache) %config %{_sysconfdir}/%{name}/config.ini
162
163 %defattr(-,root,root)
164
165 %{_initrddir}/%{name}
166 #%{_sbindir}/nagraffiti-ndo-daemon.pl
167 %{_sbindir}/nagraffiti-daemon.pl
168 %{_bindir}/cleanRrds.pl
169 %{wwwpath}
170
171 #%dir %{perl_vendorlib}/Nagraffiti
172 %{perl_vendorlib}/Nagraffiti/
173 %attr(0770, nagios, %{nagraffiti_user}) %{_datadir}/nagios-tmpfs/perfdatas
174
175 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/log/%{name}
176 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/lib/%{name}
177 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/run/%{name}

  ViewVC Help
Powered by ViewVC 1.1.8