1 |
slords |
1.2 |
# $Id: smeserver-cacti.spec,v 1.1 2008/04/21 17:25:59 slords Exp $ |
2 |
slords |
1.1 |
# Authority: nocvs |
3 |
|
|
# Name: Michel Van hees |
4 |
|
|
|
5 |
|
|
Summary: Cacti for smeserver |
6 |
|
|
%define name smeserver-cacti |
7 |
|
|
Name: %{name} |
8 |
|
|
%define version 0.8.7a |
9 |
|
|
%define release 1 |
10 |
|
|
Version: %{version} |
11 |
|
|
Release: %{release}%{?dist} |
12 |
|
|
License: Freely distributable |
13 |
|
|
Group: Apache |
14 |
|
|
Source: %{name}-%{version}.tar.gz |
15 |
|
|
#Patch0: %{name}-%{version}.patch.yyyymmddnn |
16 |
|
|
BuildRoot: /var/tmp/e-smith-buildroot |
17 |
|
|
BuildRequires: e-smith-devtools |
18 |
|
|
BuildArchitectures: noarch |
19 |
|
|
Requires: smeserver-release >= 7, rrdtool >= 1 |
20 |
|
|
AutoReqProv: no |
21 |
|
|
|
22 |
|
|
%changelog |
23 |
|
|
* Tue Dec 4 2007 Michel Van hees <michel@vanhees.cc> |
24 |
|
|
- Update contrib to 0.8.7a version |
25 |
|
|
- Adding access limitation |
26 |
|
|
- Adding automatic redirection to https |
27 |
|
|
- Automatic Update process from 0.8.6j |
28 |
|
|
|
29 |
|
|
* Mon Jan 29 2007 Michel Van hees <michel@vanhees.cc> |
30 |
|
|
- Based on cacti 0.8.6j |
31 |
|
|
- Initial release |
32 |
|
|
|
33 |
|
|
%description |
34 |
|
|
SME server - Cacti |
35 |
|
|
|
36 |
|
|
%prep |
37 |
|
|
%setup |
38 |
|
|
#%patch0 -p1 |
39 |
|
|
#%patch1 -p1 |
40 |
|
|
|
41 |
|
|
%build |
42 |
|
|
perl createlinks |
43 |
|
|
|
44 |
|
|
%install |
45 |
|
|
rm -rf $RPM_BUILD_ROOT |
46 |
|
|
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
47 |
|
|
rm -f %{name}-%{version}-filelist |
48 |
|
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
49 |
|
|
echo "%doc COPYING" >> %{name}-%{version}-filelist |
50 |
|
|
|
51 |
|
|
%clean |
52 |
|
|
rm -rf $RPM_BUILD_ROOT |
53 |
|
|
|
54 |
|
|
%pre |
55 |
|
|
/sbin/e-smith/db accounts set cacti reserved |
56 |
|
|
|
57 |
|
|
%preun |
58 |
|
|
|
59 |
|
|
%post |
60 |
|
|
/sbin/e-smith/db configuration set cacti service |
61 |
|
|
/sbin/e-smith/db configuration setprop cacti access private |
62 |
|
|
|
63 |
|
|
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
64 |
|
|
/sbin/e-smith/expand-template /opt/cacti/include/config.php |
65 |
|
|
service httpd-e-smith sigusr1 |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
cactiVersion=`mysql cacti_sme -N -s -e"select * from version"` |
69 |
|
|
case "$cactiVersion" in |
70 |
|
|
0.8.6j) |
71 |
|
|
echo "" |
72 |
|
|
echo "Upgrade process !!!!!!" |
73 |
|
|
mysql cacti_sme < /opt/cacti/cacti_upg086j.sql |
74 |
|
|
rm -f /opt/cacti/cacti_sme.sql |
75 |
|
|
rm -f /opt/cacti/cacti_upg086j.sql |
76 |
|
|
echo "Upgrade complete ..." |
77 |
|
|
echo "" |
78 |
|
|
;; |
79 |
|
|
0.8.7a) |
80 |
|
|
# Shoul not be here for the moment |
81 |
|
|
;; |
82 |
|
|
*) |
83 |
|
|
# Fresh install |
84 |
|
|
echo "" |
85 |
|
|
echo "fresh install..." |
86 |
|
|
mysqladmin create cacti_sme |
87 |
|
|
mysql cacti_sme < /opt/cacti/cacti_sme.sql |
88 |
|
|
rm -Rf /opt/cacti/install |
89 |
|
|
rm -f /opt/cacti/cacti_sme.sql |
90 |
|
|
rm -f /opt/cacti/cacti_upg086j.sql |
91 |
|
|
echo "Install complete ..." |
92 |
|
|
echo "" |
93 |
|
|
esac |
94 |
|
|
|
95 |
|
|
case "${LANG:0:2}" in |
96 |
|
|
fr) |
97 |
|
|
echo "" |
98 |
|
|
echo "Vous pouvez maintenant acceder à cacti via un browser web de la maniere suivante https://nom_server/cacti" |
99 |
|
|
echo "Vous pourrez vous loger sous admin avec comme mot de pass admin." |
100 |
|
|
echo "Si vous mettez à jour, le mot de passe admin n'aura pas changer!" |
101 |
|
|
echo "" |
102 |
|
|
echo "Attention !!!!!" |
103 |
|
|
echo "Cacti est limité en accès au réseau interne, donc pas depuis internet" |
104 |
|
|
echo "Vous pouvez changer cette option avec les commandes :" |
105 |
|
|
echo "db configuration setprop cacti access public" |
106 |
|
|
echo "signal-events console-save" |
107 |
|
|
echo "" |
108 |
|
|
;; |
109 |
|
|
*) |
110 |
|
|
echo "" |
111 |
|
|
echo "Now you can access cacti though your browser at https://server_name/cacti" |
112 |
|
|
echo "You can connect using login admin and password admin." |
113 |
|
|
echo "If you update a 2.1 version of this contribs, admin password don't change!" |
114 |
|
|
echo "" |
115 |
|
|
echo "BEWARE !!!" |
116 |
|
|
echo "Cacti is now limited to internal network, so it couldn't be access from internet" |
117 |
|
|
echo "You can change this with the following command :" |
118 |
|
|
echo "db configuration setprop cacti access public" |
119 |
|
|
echo "signal-events console-save" |
120 |
|
|
echo "" |
121 |
|
|
|
122 |
|
|
;; |
123 |
|
|
esac |
124 |
|
|
|
125 |
|
|
%postun |
126 |
|
|
/sbin/e-smith/db accounts delete cacti |
127 |
|
|
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
128 |
|
|
service httpd-e-smith sigusr1 |
129 |
|
|
if [ $1 = 0 ] ; then |
130 |
|
|
# action to been done if remove |
131 |
|
|
case "${LANG:0:2}" in |
132 |
|
|
fr) |
133 |
|
|
echo "" |
134 |
|
|
echo "La base de donnée ne sera pas effacé" |
135 |
|
|
echo "Si vous voulez supprimer la base de donnée lancé la commande suivante :" |
136 |
|
|
echo "mysqladmin drop cacti_sme" |
137 |
|
|
;; |
138 |
|
|
*) |
139 |
|
|
echo "" |
140 |
|
|
echo "Database will not be removed" |
141 |
|
|
echo "If you want to remove completly the database launch" |
142 |
|
|
echo "mysqladmin drop cacti_sme" |
143 |
|
|
;; |
144 |
|
|
esac |
145 |
|
|
|
146 |
|
|
fi |
147 |
|
|
|
148 |
|
|
%files -f %{name}-%{version}-filelist |
149 |
|
|
%defattr(-,root,root) |