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