/[nagraffiti]/nagraffiti.spec
ViewVC logotype

Contents of /nagraffiti.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 17 - (show annotations) (download)
Fri Apr 6 09:46:31 2012 UTC (7 years, 4 months ago) by racvision
File size: 4849 byte(s)
resynchro svn
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.5
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 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 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 # 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}/classes
51 %{__install} -p -m0644 www/classes/*.php $RPM_BUILD_ROOT/%{wwwpath}/classes/
52
53 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/css
54 %{__install} -p -m0644 www/css/*.css $RPM_BUILD_ROOT/%{wwwpath}/css/
55
56 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/img
57 %{__install} -p -m0644 www/img/* $RPM_BUILD_ROOT/%{wwwpath}/img/
58
59 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/js
60 %{__install} -p -m0644 www/js/*.js $RPM_BUILD_ROOT/%{wwwpath}/js/
61
62 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/%{name}
63 %{__install} -p -m0644 www/%{name}/*.php $RPM_BUILD_ROOT/%{wwwpath}/%{name}/
64
65 %{__install} -p -m0644 www/index.php $RPM_BUILD_ROOT/%{wwwpath}/
66
67 # Templates
68 %{__install} -d $RPM_BUILD_ROOT/%{wwwpath}/templates
69 %{__install} -p -m0644 www/templates/*.php $RPM_BUILD_ROOT/%{wwwpath}/templates/
70
71 # backend
72 %{__install} -d $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti/
73 %{__install} -p -m0755 backend/*.pm $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti/
74
75 %{__install} -d $RPM_BUILD_ROOT/%{_sbindir}
76 %{__install} -p -m0755 backend/nagraffiti-ndo-daemon.pl $RPM_BUILD_ROOT/%{_sbindir}/
77 %{__install} -p -m0755 backend/nagraffiti-fifo-daemon.pl $RPM_BUILD_ROOT/%{_sbindir}/
78
79 # Configs files:
80 %{__install} -d $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
81 %{__install} -p -m0640 backend/config.ini $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
82 %{__install} -p -m0644 backend/rra.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
83
84 # Logs files:
85 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/log/%{name}
86
87 # Rrd repository:
88 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}
89
90 # Pid
91 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/run/%{name}
92
93
94 # Init script
95 %{__install} -d $RPM_BUILD_ROOT/%{_initrddir}
96 %{__install} -p -m0755 backend/%{name}.init $RPM_BUILD_ROOT/%{_initrddir}/%{name}
97
98
99 # I18n files
100 for lang in fr; do
101 %{__install} -d $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/
102 %{__install} -m0644 po/init-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_init.mo
103 %{__install} -m0644 po/php-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_php.mo
104 done
105
106 %{find_lang} %{name}_init %{name}_lang --all-name
107
108 #====[ pre installation scripts:
109 %pre
110
111 # Add user/group:
112 echo Adding %{nagraffiti_user} user ...
113 /usr/sbin/useradd -M -o -r -d %{_localstatedir}/log/%{name} -s /sbin/nologin -c "Application Nagraffiti" -u 407 %{nagraffiti_user} > /dev/null 2>&1 || :
114
115 # Add apache in nagraffiti group
116 if ! id -Gn apache | grep -q nagraffiti ; then
117 echo "Adding user 'apache' to 'nagraffiti' group."
118 usermod -aG nagraffiti apache
119 fi
120
121 #====[ post installation scripts:
122 %post
123
124 # Configure database password :
125 /usr/bin/mkpasswd -l 10 -s 0 > %{mysql_passwd_path}/%{name}
126 %{__chmod} 640 %{mysql_passwd_path}/%{name}
127
128 # Add initscript to system V start :
129 if test -x /sbin/chkconfig; then
130 /sbin/chkconfig --add %{name}
131 /sbin/chkconfig %{name} on
132 fi
133
134
135 #====[ pre uninstall scripts
136 %preun
137
138 %postun
139
140 %files -f %{name}_lang
141 %doc backend/README
142 %defattr(-,%{nagraffiti_user},%{nagraffiti_user})
143 %config %{_sysconfdir}/%{name}/config.ini
144 %config %{_sysconfdir}/%{name}/rra.cfg
145
146 %defattr(-,root,root)
147
148 %{_initrddir}/%{name}
149 %{_sbindir}/nagraffiti-ndo-daemon.pl
150 %{_sbindir}/nagraffiti-fifo-daemon.pl
151 %{wwwpath}
152 %{wwwpath}/../racvision/
153
154 %dir %{perl_vendorlib}/Nagraffiti
155 %{perl_vendorlib}/Nagraffiti/*.pm
156
157 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/log/%{name}
158 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/lib/%{name}
159 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/run/%{name}

  ViewVC Help
Powered by ViewVC 1.1.8