/[nagraffiti]/nagraffiti.spec
ViewVC logotype

Contents of /nagraffiti.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14 - (show annotations) (download)
Fri Aug 12 14:39:22 2011 UTC (7 years, 8 months ago) by racvision
File size: 4625 byte(s)
add livestatus support
1 # release number:
2 %define rel %(date '+%Y%m%d%H%M')
3
4 %define wwwpath /var/www/html/nagraffiti
5 %define nagraffiti_user nagraffiti
6
7 Summary: Nagios grapher
8 Name: nagraffiti
9 Version: 1.4
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
17 Provides: perl(Nagraffiti::Nagraph)
18 BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
19
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 can use NDO utils or Livestatus to collect data.
27
28
29 %description -l fr
30 Nagraffiti est un traceur de donnée de performance issues de Nagios. Il peut utiliser NDO utils ou Livestatus 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 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/classes
46 %{__install} -p -m0644 www/classes/*.php $RPM_BUILD_ROOT/%{wwwpath}/classes/
47
48 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/css
49 %{__install} -p -m0644 www/css/*.css $RPM_BUILD_ROOT/%{wwwpath}/css/
50
51 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/img
52 %{__install} -p -m0644 www/img/* $RPM_BUILD_ROOT/%{wwwpath}/img/
53
54 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/js
55 %{__install} -p -m0644 www/js/*.js $RPM_BUILD_ROOT/%{wwwpath}/js/
56
57 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}
58 %{__install} -p -m0644 www/%{name}/*.php $RPM_BUILD_ROOT/%{wwwpath}/%{name}/
59
60 %{__install} -p -m0644 www/index.php $RPM_BUILD_ROOT/%{wwwpath}/
61
62
63 # Templates
64 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/templates
65 %{__install} -p -m0644 www/templates/*.php $RPM_BUILD_ROOT/%{wwwpath}/templates/
66
67 # backend
68 %{__install} -d $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti/
69 %{__install} -p -m0755 backend/*.pm $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti/
70
71 %{__install} -d $RPM_BUILD_ROOT/%{_sbindir}
72 %{__install} -p -m0755 backend/nagraffiti-ndo-daemon.pl $RPM_BUILD_ROOT/%{_sbindir}/
73 %{__install} -p -m0755 backend/nagraffiti-fifo-daemon.pl $RPM_BUILD_ROOT/%{_sbindir}/
74
75 # Configs files:
76 %{__install} -d $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
77 %{__install} -p -m0640 backend/config.ini $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
78 %{__install} -p -m0644 backend/rra.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
79
80 # Logs files:
81 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/log/%{name}
82
83 # Rrd repository:
84 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}
85
86 # Pid
87 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/run/%{name}
88
89
90 # Init script
91 %{__install} -d $RPM_BUILD_ROOT/%{_initrddir}
92 %{__install} -p -m0755 backend/%{name}.init $RPM_BUILD_ROOT/%{_initrddir}/%{name}
93
94
95 # I18n files
96 for lang in fr; do
97 %{__install} -d $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/
98 %{__install} -m0644 po/init-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_init.mo
99 %{__install} -m0644 po/php-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_php.mo
100 done
101
102 %{find_lang} %{name}_init %{name}_lang --all-name
103
104 #====[ pre installation scripts:
105 %pre
106
107 # Add user/group:
108 echo Adding %{nagraffiti_user} user ...
109 /usr/sbin/useradd -M -o -r -d %{_localstatedir}/log/%{name} -s /sbin/nologin -c "Application Nagraffiti" -u 407 %{nagraffiti_user} > /dev/null 2>&1 || :
110
111 # Add apache in nagraffiti group
112 if ! id -Gn apache | grep -q nagraffiti ; then
113 echo "Adding user 'apache' to 'nagraffiti' group."
114 usermod -aG nagraffiti apache
115 fi
116
117 #====[ post installation scripts:
118 %post
119
120 # Configure database password :
121 /usr/bin/mkpasswd -l 10 -s 0 > %{mysql_passwd_path}/%{name}
122 %{__chmod} 640 %{mysql_passwd_path}/%{name}
123
124 # Add initscript to system V start :
125 if test -x /sbin/chkconfig; then
126 /sbin/chkconfig --add %{name}
127 /sbin/chkconfig %{name} on
128 fi
129
130
131 #====[ pre uninstall scripts
132 %preun
133
134 %postun
135
136 %files -f %{name}_lang
137 #%doc README
138 %defattr(-,%{nagraffiti_user},%{nagraffiti_user})
139 %config %{_sysconfdir}/%{name}/config.ini
140 %config %{_sysconfdir}/%{name}/rra.cfg
141
142 %defattr(-,root,root)
143
144 %{_initrddir}/%{name}
145 %{_sbindir}/nagraffiti-ndo-daemon.pl
146 %{_sbindir}/nagraffiti-fifo-daemon.pl
147 %{wwwpath}
148
149 %dir %{perl_vendorlib}/Nagraffiti
150 %{perl_vendorlib}/Nagraffiti/*.pm
151
152 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/log/%{name}
153 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/lib/%{name}
154 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/run/%{name}

  ViewVC Help
Powered by ViewVC 1.1.8