/[nagraffiti]/nagraffiti.spec
ViewVC logotype

Contents of /nagraffiti.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations) (download)
Wed Nov 4 16:45:46 2009 UTC (9 years, 5 months ago) by racvision
File size: 4094 byte(s)
first import
1 racvision 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.0
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     # backend
64     %{__install} -d $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti/
65     %{__install} -p -m0755 backend/*.pm $RPM_BUILD_ROOT/%{perl_vendorlib}/Nagraffiti/
66    
67     %{__install} -d $RPM_BUILD_ROOT/%{_sbindir}
68     %{__install} -p -m0755 backend/nagraffitid.pl $RPM_BUILD_ROOT/%{_sbindir}/
69    
70     # Configs files:
71     %{__install} -d $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
72     %{__install} -p -m0640 backend/config.ini $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
73     %{__install} -p -m0644 backend/rra.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/
74    
75     # Logs files:
76     %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/log/%{name}
77    
78     # Rrd repository:
79     %{__install} -d $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}
80    
81     # Init script
82     %{__install} -d $RPM_BUILD_ROOT/%{_initrddir}
83     %{__install} -p -m0755 backend/%{name}.init $RPM_BUILD_ROOT/%{_initrddir}/%{name}
84    
85    
86     # I18n files
87     for lang in fr_FR; do
88     %{__install} -d $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/
89     %{__install} -m0644 po/init-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_init.mo
90     %{__install} -m0644 po/php-$lang.mo $RPM_BUILD_ROOT/%{_datadir}/locale/$lang/LC_MESSAGES/%{name}_php.mo
91     done
92    
93     %{find_lang} %{name}_init %{name}_lang --all-name
94    
95     #====[ pre installation scripts:
96     %pre
97    
98     # Add user/group:
99     echo Adding %{nagraffiti_user} user ...
100     /usr/sbin/useradd -M -o -r -d %{_localstatedir}/log/%{name} -s /sbin/nologin -c "Application Nagraffiti" -u 407 %{nagraffiti_user} > /dev/null 2>&1 || :
101    
102     # Add apache in nagraffiti group
103     if ! id -Gn apache | grep -q nagraffiti ; then
104     echo "Adding user 'apache' to 'nagraffiti' group."
105     usermod -aG nagraffiti apache
106     fi
107    
108     #====[ post installation scripts:
109     %post
110    
111     # Configure database password :
112     /usr/bin/mkpasswd -l 10 -s 0 > %{mysql_passwd_path}/%{name}
113     %{__chmod} 640 %{mysql_passwd_path}/%{name}
114    
115     # Add initscript to system V start :
116     if test -x /sbin/chkconfig; then
117     /sbin/chkconfig --add %{name}
118     /sbin/chkconfig %{name} on
119     fi
120    
121    
122     #====[ pre uninstall scripts
123     %preun
124    
125     %postun
126    
127     %files -f %{name}_lang
128     #%doc README
129     %defattr(-,root,root)
130    
131     %{_initrddir}/%{name}
132     %{_sbindir}/nagraffitid.pl
133     %config %{_sysconfdir}/%{name}/config.ini
134     %config %{_sysconfdir}/%{name}/rra.cfg
135     %{wwwpath}
136    
137     %dir %{perl_vendorlib}/Nagraffiti
138     %{perl_vendorlib}/Nagraffiti/*.pm
139    
140     %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/log/%{name}
141     %attr(-,%{nagraffiti_user} ,%{nagraffiti_user}) %dir %{_localstatedir}/lib/%{name}

  ViewVC Help
Powered by ViewVC 1.1.8