/[nagraffiti]/nagraffiti.spec
ViewVC logotype

Contents of /nagraffiti.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (show annotations) (download)
Thu Aug 12 15:45:42 2010 UTC (8 years, 8 months ago) by racvision
File size: 4241 byte(s)
update to version 1.1 - add template support + many fixes
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.1
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 use NDO utils to collect data.
27
28
29 %description -l fr
30 Nagraffiti est un traceur de donnée de performance issues de Nagios. Il utilise NDO utils 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/nagraffitid.pl $RPM_BUILD_ROOT/%{_sbindir}/
73
74 # Configs files:
75 %{__install} -d $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
76 %{__install} -p -m0640 backend/config.ini $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
77 %{__install} -p -m0644 backend/rra.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
78
79 # Logs files:
80 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/log/%{name}
81
82 # Rrd repository:
83 %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}
84
85 # Init script
86 %{__install} -d $RPM_BUILD_ROOT/%{_initrddir}
87 %{__install} -p -m0755 backend/%{name}.init $RPM_BUILD_ROOT/%{_initrddir}/%{name}
88
89
90 # I18n files
91 for lang in fr_FR; do
92 %{__install} -d $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/
93 %{__install} -m0644 po/init-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_init.mo
94 %{__install} -m0644 po/php-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_php.mo
95 done
96
97 %{find_lang} %{name}_init %{name}_lang --all-name
98
99 #====[ pre installation scripts:
100 %pre
101
102 # Add user/group:
103 echo Adding %{nagraffiti_user} user ...
104 /usr/sbin/useradd -M -o -r -d %{_localstatedir}/log/%{name} -s /sbin/nologin -c "Application Nagraffiti" -u 407 %{nagraffiti_user} > /dev/null 2>&1 || :
105
106 # Add apache in nagraffiti group
107 if ! id -Gn apache | grep -q nagraffiti ; then
108 echo "Adding user 'apache' to 'nagraffiti' group."
109 usermod -aG nagraffiti apache
110 fi
111
112 #====[ post installation scripts:
113 %post
114
115 # Configure database password :
116 /usr/bin/mkpasswd -l 10 -s 0 > %{mysql_passwd_path}/%{name}
117 %{__chmod} 640 %{mysql_passwd_path}/%{name}
118
119 # Add initscript to system V start :
120 if test -x /sbin/chkconfig; then
121 /sbin/chkconfig --add %{name}
122 /sbin/chkconfig %{name} on
123 fi
124
125
126 #====[ pre uninstall scripts
127 %preun
128
129 %postun
130
131 %files -f %{name}_lang
132 #%doc README
133 %defattr(-,root,root)
134
135 %{_initrddir}/%{name}
136 %{_sbindir}/nagraffitid.pl
137 %config %{_sysconfdir}/%{name}/config.ini
138 %config %{_sysconfdir}/%{name}/rra.cfg
139 %{wwwpath}
140
141 %dir %{perl_vendorlib}/Nagraffiti
142 %{perl_vendorlib}/Nagraffiti/*.pm
143
144 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/log/%{name}
145 %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/lib/%{name}

  ViewVC Help
Powered by ViewVC 1.1.8