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