1 |
slords |
1.2 |
# $Id$ |
2 |
|
|
# Authority: cool34000 |
3 |
|
|
# Name: Sylvain Gomez |
4 |
|
|
|
5 |
slords |
1.1 |
%define name smeserver-inventory-tools |
6 |
|
|
%define version 1 |
7 |
|
|
%define release 7 |
8 |
|
|
%define rpmver 4.0.4 |
9 |
|
|
|
10 |
|
|
|
11 |
|
|
Summary: OCS Inventory NG and GLPI are web-based Inventory tool & Information Resource-Manager |
12 |
|
|
Name: %{name} |
13 |
|
|
Version: %{version} |
14 |
|
|
Release: %{release}%{?dist} |
15 |
|
|
License: GPL |
16 |
|
|
Group: SME/Addon |
17 |
|
|
Source: %{name}-%{version}.tar.gz |
18 |
|
|
URL: http://www.ocsinventory-ng.org/,http://www.glpi-project.org/ |
19 |
|
|
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
20 |
|
|
Requires: e-smith-base |
21 |
|
|
Requires: e-smith-release >= 7 |
22 |
|
|
Requires: mod_perl >= 1.99_16-4 |
23 |
|
|
Requires: monitor-edid >= 1.11-1 |
24 |
|
|
Requires: ocsinventory-ipdiscover >= 1.01-2 |
25 |
|
|
Requires: ocsinventory-agent >= 0.0.6-1 |
26 |
|
|
Requires: perl-Apache-DBI >= 0.9901-2.2 |
27 |
|
|
Requires: perl-Archive-Tar >= 1.23-3.99_2 |
28 |
|
|
Requires: perl-Compress-Zlib >= 1.42-1 |
29 |
|
|
Requires: perl-Crypt-OpenSSL-Bignum >= 0.03-1.2 |
30 |
|
|
Requires: perl-Crypt-OpenSSL-RSA >= 0.21-1.2 |
31 |
|
|
Requires: perl-IO-Socket-SSL >= 1.01-1 |
32 |
|
|
Requires: perl-IO-Zlib >= 1.04-2 |
33 |
|
|
Requires: perl-Mail-DomainKeys >= 0.21-2 |
34 |
|
|
Requires: perl-MIME-Lite >= 3.01-2.2 |
35 |
|
|
Requires: perl-Net-IP >= 1.23-1 |
36 |
|
|
Requires: perl-Net-Jabber >= 2.0-1.2 |
37 |
|
|
Requires: perl-Net-XMPP >= 1.0-1.2 |
38 |
|
|
Requires: perl-SOAP-Lite >= 0.69-1 |
39 |
|
|
Requires: perl-XML-SAX >= -0.12-7 |
40 |
|
|
Requires: perl-XML-Simple >= 2.14-4 |
41 |
|
|
Requires: perl-XML-Stream >= 1.22-1.2 |
42 |
|
|
BuildRequires: e-smith-devtools |
43 |
|
|
Conflicts: smeserver-ocs_inventory_ng |
44 |
|
|
Conflicts: smeserver-glpi |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
%description |
48 |
|
|
This RPM is an unofficial addon for the SME Server 7.x. |
49 |
|
|
OCS Inventory NG is an application designed to help a network or system administrator |
50 |
|
|
keep track of the computers configuration and software that are installed on the network. |
51 |
|
|
GLPI is the Information Resource-Manager with an additional Administration-Interface. |
52 |
|
|
http://your_server/ocs |
53 |
|
|
http://your_server/glpi |
54 |
|
|
|
55 |
|
|
|
56 |
|
|
%changelog |
57 |
|
|
* Sat Nov 10 2007 Sylvain Gomez <sylvaingomez@free.fr> |
58 |
|
|
[1-7] Security fix |
59 |
|
|
- Fix security issue on dbconfig.inc.php - We now use root:www 440 |
60 |
|
|
- Fix perms on ocsreports folder and ipdiscover-util.pl (750 for both) |
61 |
|
|
- Fix problem while importing ocsagent.exe into MySQL |
62 |
|
|
- MaxUpload limit raised to 100M by default (new install only) |
63 |
|
|
|
64 |
|
|
* Thu Nov 8 2007 Sylvain Gomez <sylvaingomez@free.fr> |
65 |
|
|
[1-6] Maintenance release - Thanks again to Stefen Noble <support@dungog.net> |
66 |
|
|
- Removed useless MySQL custom-template |
67 |
|
|
- Removed ocsagent.exe guide.pdf |
68 |
|
|
- Upload limit fixed |
69 |
|
|
- 'MaxUpload' DB entry added to set dynamically max upload file size (default still at 10M) |
70 |
|
|
- Events moved to domain-modify |
71 |
|
|
- 2 new 'url' types added for ocs' virtual locations |
72 |
|
|
- Uninstall script now also deletes new DB values + logs + old inventories |
73 |
|
|
- Improved Apache templates to allow adding aliases for both web interfaces |
74 |
|
|
- RPM runs verbosely |
75 |
|
|
|
76 |
|
|
* Wed Nov 7 2007 Sylvain Gomez <sylvaingomez@free.fr> |
77 |
|
|
[1-5] Fixing Deployment feature - Thanks again to Stefen Noble <support@dungog.net> |
78 |
|
|
- New apache template to add cacert.pem file |
79 |
|
|
- cacert.pem is copied from your existing ssl.srt if not present |
80 |
|
|
|
81 |
|
|
* Tue Nov 6 2007 Sylvain Gomez <sylvaingomez@free.fr> |
82 |
|
|
[1-4] Fixing a few bugs |
83 |
|
|
- perl-XML-SAX added to dependencies list |
84 |
|
|
- Fix /usr/lib/perl5/vendor_perl/5.8.5/XML/SAX/ParserDetails.ini not existing |
85 |
|
|
- Account 'download' created with type 'url' |
86 |
|
|
|
87 |
|
|
* Tue Nov 6 2007 Sylvain Gomez <sylvaingomez@free.fr> |
88 |
|
|
[1-3] Fixing a few bugs and minor changes. Thanks to Stefen Noble <support@dungog.net> |
89 |
|
|
- MySQL database is imported with a safer method (use IF NOT EXIST) |
90 |
|
|
- OCS Apache template modified |
91 |
|
|
- Minor changes in the uninstall script |
92 |
|
|
- Crond restart deleted (not needed) |
93 |
|
|
- Launching inventory is for install only now (not update) |
94 |
|
|
- Type changed to url instead of reserved |
95 |
|
|
|
96 |
|
|
* Sun Nov 4 2007 Sylvain Gomez <sylvaingomez@free.fr> |
97 |
|
|
[1-2] Fixing a few bugs |
98 |
|
|
- Upload fixed |
99 |
|
|
- OCS Apache template modified |
100 |
|
|
- ocsagent.exe is now included in ./ocs/files |
101 |
|
|
|
102 |
|
|
* Fri Nov 2 2007 Sylvain Gomez <sylvaingomez@free.fr> |
103 |
|
|
[1-1] Original version |
104 |
|
|
- OCS Inventory NG 1.01 |
105 |
|
|
- OCS Linux Agent 0.0.6 |
106 |
|
|
- GLPI 0.68.3-2 |
107 |
|
|
|
108 |
|
|
|
109 |
|
|
%prep |
110 |
|
|
|
111 |
|
|
|
112 |
|
|
%setup |
113 |
|
|
|
114 |
|
|
|
115 |
|
|
%build |
116 |
|
|
perl createlinks |
117 |
|
|
|
118 |
|
|
# Default DB parameters |
119 |
|
|
DEFAULTS1=root/etc/e-smith/db/configuration/defaults/ocs |
120 |
|
|
DEFAULTS2=root/etc/e-smith/db/accounts/defaults/ocs |
121 |
|
|
DEFAULTS3=root/etc/e-smith/db/configuration/defaults/glpi |
122 |
|
|
DEFAULTS4=root/etc/e-smith/db/accounts/defaults/glpi |
123 |
|
|
DEFAULTS5=root/etc/e-smith/db/accounts/defaults/download |
124 |
|
|
DEFAULTS6=root/etc/e-smith/db/accounts/defaults/ocsinterface |
125 |
|
|
DEFAULTS7=root/etc/e-smith/db/accounts/defaults/ocsinventory |
126 |
|
|
mkdir -p $DEFAULTS1 |
127 |
|
|
mkdir -p $DEFAULTS2 |
128 |
|
|
mkdir -p $DEFAULTS3 |
129 |
|
|
mkdir -p $DEFAULTS4 |
130 |
|
|
mkdir -p $DEFAULTS5 |
131 |
|
|
mkdir -p $DEFAULTS6 |
132 |
|
|
mkdir -p $DEFAULTS7 |
133 |
|
|
echo "ocsweb" > $DEFAULTS1/DbName |
134 |
|
|
echo "ocs" > $DEFAULTS1/DbUser |
135 |
|
|
echo "off" > $DEFAULTS1/HTTPS |
136 |
|
|
echo "global" > $DEFAULTS1/InventoryAccess |
137 |
|
|
echo "600" > $DEFAULTS1/InventoryDelay |
138 |
|
|
echo "localhost" > $DEFAULTS1/InventoryServer |
139 |
|
|
echo "100M" > $DEFAULTS1/MaxUpload |
140 |
|
|
echo "OCS Inventory NG" > $DEFAULTS1/Name |
141 |
|
|
echo "local" > $DEFAULTS1/PublicAccess |
142 |
|
|
echo "service" > $DEFAULTS1/type |
143 |
|
|
echo "url" > $DEFAULTS2/type |
144 |
|
|
echo "glpi" > $DEFAULTS3/DbName |
145 |
|
|
echo "glpi" > $DEFAULTS3/DbUser |
146 |
|
|
echo "off" > $DEFAULTS3/HTTPS |
147 |
|
|
echo "GLPI" > $DEFAULTS3/Name |
148 |
|
|
echo "local" > $DEFAULTS3/PublicAccess |
149 |
|
|
echo "service" > $DEFAULTS3/type |
150 |
|
|
echo "url" > $DEFAULTS4/type |
151 |
|
|
echo "url" > $DEFAULTS5/type |
152 |
|
|
echo "url" > $DEFAULTS6/type |
153 |
|
|
echo "url" > $DEFAULTS7/type |
154 |
|
|
|
155 |
|
|
# Creating templates.metadata |
156 |
|
|
TEMPLATE1=root/etc/e-smith/templates.metadata/etc/e-smith/sql/init |
157 |
|
|
TEMPLATE2=root/etc/e-smith/templates.metadata/opt/inventory/ocs/ocsreports |
158 |
|
|
TEMPLATE3=root/etc/e-smith/templates.metadata/opt/inventory/glpi/config |
159 |
|
|
mkdir -p $TEMPLATE1 |
160 |
|
|
mkdir -p $TEMPLATE2 |
161 |
|
|
mkdir -p $TEMPLATE3 |
162 |
|
|
echo 'PERMS=0540' > $TEMPLATE1/80ocs_mysql.sql |
163 |
|
|
echo 'PERMS=0540' > $TEMPLATE1/80glpi_mysql.sql |
164 |
|
|
echo 'PERMS=0540' > $TEMPLATE1/81ocs-glpi.sql |
165 |
|
|
echo 'UID="root"' > $TEMPLATE2/dbconfig.inc.php |
166 |
|
|
echo 'GID="www"' >> $TEMPLATE2/dbconfig.inc.php |
167 |
|
|
echo 'PERMS=0440' >> $TEMPLATE2/dbconfig.inc.php |
168 |
|
|
echo 'UID="root"' > $TEMPLATE3/config_db.php |
169 |
|
|
echo 'GID="www"' >> $TEMPLATE3/config_db.php |
170 |
|
|
echo 'PERMS=0440' >> $TEMPLATE3/config_db.php |
171 |
|
|
|
172 |
|
|
|
173 |
|
|
%install |
174 |
|
|
rm -rf $RPM_BUILD_ROOT |
175 |
|
|
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
176 |
|
|
rm -f %{name}-%{version}-filelist |
177 |
|
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
178 |
|
|
|
179 |
|
|
|
180 |
|
|
%clean |
181 |
|
|
rm -rf $RPM_BUILD_ROOT |
182 |
|
|
|
183 |
|
|
|
184 |
|
|
%pre |
185 |
|
|
# Checking if Inventory files are present before updating |
186 |
|
|
# If present, installation files + MySQL DB + DB values are saved |
187 |
|
|
if [ -d /opt/inventory ]; then |
188 |
|
|
case $LANG in |
189 |
|
|
fr_FR) echo "Sauvegarde de l'ancienne install dans /opt/RPM_BACKUP" ;; |
190 |
|
|
*) echo "Backing up old install in /opt/RPM_BACKUP" ;; |
191 |
|
|
esac |
192 |
|
|
mkdir -p /opt/RPM_BACKUP |
193 |
|
|
cd /opt |
194 |
|
|
tar -czf /opt/RPM_BACKUP/ocs_glpi.tar.gz inventory |
195 |
|
|
if [ -d /opt/inventory/ocs ] ; then |
196 |
|
|
mysqldump ocsweb > /opt/RPM_BACKUP/ocs.sql |
197 |
|
|
fi |
198 |
|
|
if [ -d /opt/inventory/glpi ] ; then |
199 |
|
|
mysqldump glpi > /opt/RPM_BACKUP/glpi.sql |
200 |
|
|
fi |
201 |
|
|
/sbin/e-smith/db configuration show ocs > /opt/RPM_BACKUP/ocs_glpi-config.txt |
202 |
|
|
echo " " >> /opt/RPM_BACKUP/ocs_glpi-config.txt |
203 |
|
|
/sbin/e-smith/db configuration show glpi >> /opt/RPM_BACKUP/ocs_glpi-config.txt |
204 |
|
|
fi |
205 |
|
|
|
206 |
|
|
|
207 |
|
|
%post |
208 |
|
|
# Initializing SME DB |
209 |
|
|
/etc/e-smith/events/actions/initialize-default-databases |
210 |
|
|
|
211 |
|
|
# Variables |
212 |
|
|
DOMAIN=$(/sbin/e-smith/db configuration get DomainName) |
213 |
|
|
SRVNAME=$(/sbin/e-smith/db configuration get SystemName) |
214 |
|
|
UPDATE=$(ls /opt | grep -c inventory) |
215 |
|
|
if [ -d /opt/inventory/ocs ] ; then UPDTOCS=1 ; else UPDTOCS=0 ; fi |
216 |
|
|
if [ -d /opt/inventory/glpi ] ; then UPDTGLPI=1 ; else UPDTGLPI=0 ; fi |
217 |
|
|
|
218 |
|
|
# Decompressing files |
219 |
|
|
mkdir -p /opt/inventory |
220 |
|
|
tar -xzf /usr/share/doc/smeserver-OCS_GLPI/Sources/ocs.tar.gz -C /opt/inventory |
221 |
|
|
tar -xzf /usr/share/doc/smeserver-OCS_GLPI/Sources/glpi.tar.gz -C /opt/inventory |
222 |
|
|
|
223 |
|
|
# Preparing configuration |
224 |
|
|
mkdir -p /var/log/ocsinventory-NG |
225 |
|
|
chown www:www /var/log/ocsinventory-NG |
226 |
|
|
chmod 775 /var/log/ocsinventory-NG |
227 |
|
|
rm -rf /opt/inventory/conf |
228 |
|
|
rm -f /etc/ocsinventory-agent/ocsinv.conf |
229 |
|
|
mv /usr/lib/perl5/site_perl/5.8.5/Apache/Ocsinventory/Server/Modperl2.pm.txt /usr/lib/perl5/site_perl/5.8.5/Apache/Ocsinventory/Server/Modperl2.pm |
230 |
|
|
if [ "$UPDTOCS" = "0" ] ; then |
231 |
|
|
cp /usr/share/doc/smeserver-OCS_GLPI/Sources/ocs.sql /etc/e-smith/sql/init/81ocs_db.sql |
232 |
|
|
fi |
233 |
|
|
if [ "$UPDTGLPI" = "0" ] ; then |
234 |
|
|
cp /usr/share/doc/smeserver-OCS_GLPI/Sources/glpi-$LANG.sql /etc/e-smith/sql/init/83glpi_db.sql |
235 |
|
|
fi |
236 |
|
|
/sbin/e-smith/config setprop modPerl status enabled |
237 |
|
|
/sbin/e-smith/config setprop mysqld InnoDB enabled |
238 |
|
|
|
239 |
|
|
# Fixing XML::SAX ParserDetails.ini |
240 |
|
|
if [ ! -e /usr/lib/perl5/vendor_perl/5.8.5/XML/SAX/ParserDetails.ini ]; then |
241 |
|
|
touch /usr/lib/perl5/vendor_perl/5.8.5/XML/SAX/ParserDetails.ini |
242 |
|
|
chmod 444 /usr/lib/perl5/vendor_perl/5.8.5/XML/SAX/ParserDetails.ini |
243 |
|
|
perl -MXML::SAX -e "XML::SAX->add_parser(q(XML::SAX::PurePerl))->save_parsers()" |
244 |
|
|
fi |
245 |
|
|
|
246 |
|
|
# Copying SME's certificate into cacert.pem if the file do not exist |
247 |
|
|
# This file is used by deployment function |
248 |
|
|
if [ ! -e /home/e-smith/ssl.crt/cacert.pem ]; then |
249 |
|
|
cp /home/e-smith/ssl.crt/$SRVNAME.$DOMAIN.crt /home/e-smith/ssl.crt/cacert.pem |
250 |
|
|
fi |
251 |
|
|
|
252 |
|
|
# Applying modifications |
253 |
|
|
/sbin/e-smith/expand-template /etc/my.cnf |
254 |
|
|
service mysqld restart 2>/dev/null >/dev/null |
255 |
|
|
/sbin/e-smith/signal-event domain-modify |
256 |
|
|
|
257 |
|
|
if [ "$UPDTOCS" = "0" ] ; then |
258 |
|
|
case $LANG in |
259 |
|
|
fr_FR) echo "Inventaire du serveur SME en cours, veuillez patienter..." ;; |
260 |
|
|
*) echo "Inventorying SME Server, please wait this may take a while..." ;; |
261 |
|
|
esac |
262 |
|
|
/usr/sbin/ocsinventory-agent -s localhost |
263 |
|
|
fi |
264 |
|
|
|
265 |
|
|
echo "-------------------------------------------------------------------------------" |
266 |
|
|
case $LANG in |
267 |
|
|
fr_FR) |
268 |
|
|
case $UPDATE in |
269 |
|
|
0) echo "Installation d'OCS Inventory NG (Serveur+Agent) & GLPI terminée !" ;; |
270 |
|
|
*) echo "Mise à jour d'OCS Inventory NG (Serveur+Agent) & GLPI terminée !" ;; |
271 |
|
|
esac |
272 |
|
|
echo "Pour plus de détails, visitez http://wiki.contribs.org/OCS_Inventory_Tools/fr" ;; |
273 |
|
|
*) |
274 |
|
|
case $UPDATE in |
275 |
|
|
0) echo "OCS Inventory NG (Server+Agent) & GLPI Installation finished!" ;; |
276 |
|
|
*) echo "OCS Inventory NG (Server+Agent) & GLPI Update finished!" ;; |
277 |
|
|
esac |
278 |
|
|
echo "For more details, see http://wiki.contribs.org/OCS_Inventory_Tools" ;; |
279 |
|
|
esac |
280 |
|
|
echo "-------------------------------------------------------------------------------" |
281 |
|
|
|
282 |
|
|
|
283 |
|
|
%preun |
284 |
|
|
if [ $1 = 0 ] ; then |
285 |
|
|
mv /usr/share/doc/smeserver-OCS_GLPI/Sources/DO_NOT_USE_OR_DELETE/OCS_GLPI-Full-Uninstall.sh /root/ |
286 |
|
|
mv /usr/lib/perl5/site_perl/5.8.5/Apache/Ocsinventory/Server/Modperl2.pm /usr/lib/perl5/site_perl/5.8.5/Apache/Ocsinventory/Server/Modperl2.pm.txt |
287 |
|
|
fi |
288 |
|
|
|
289 |
|
|
|
290 |
|
|
%postun |
291 |
|
|
if [ $1 = 0 ] ; then |
292 |
|
|
# Restoring default default values..." |
293 |
|
|
/sbin/e-smith/config setprop mysqld InnoDB disabled |
294 |
|
|
/sbin/e-smith/expand-template /etc/my.cnf |
295 |
|
|
service mysqld restart 2>/dev/null >/dev/null |
296 |
|
|
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
297 |
|
|
/etc/rc7.d/S86httpd-e-smith sigusr1 2>/dev/null >/dev/null |
298 |
|
|
|
299 |
|
|
echo "Uninstallation finished!" |
300 |
|
|
echo " " |
301 |
|
|
echo "If you want to completly remove OCS & GLPI" |
302 |
|
|
echo "(installation files, MySQL user+database and Agent RPMs)" |
303 |
|
|
echo "please issue the following command at the prompt:" |
304 |
|
|
echo "# sh /root/OCS_GLPI-Full-Uninstall.sh" |
305 |
|
|
fi |
306 |
|
|
|
307 |
|
|
|
308 |
|
|
%files -f %{name}-%{version}-filelist |
309 |
|
|
|
310 |
|
|
|
311 |
|
|
%defattr(-,root,root) |