summaryrefslogtreecommitdiffstats
path: root/glpi-ocsinventoryng.spec
blob: 7ddcd83daf95fc20f1744909016798b6c142d5f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# remirepo spec file for glpi-ocsinventoryng
#
# Copyright (c) 2013-2019 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global pluginname   ocsinventoryng
%global lockname     ocsinventoryng.lock

Name:           glpi-ocsinventoryng
Version:        1.6.0
Release:        1%{?dist}
Summary:        Plugin to synchronize GLPI with OCS Inventory NG

License:        GPLv2+
URL:            https://github.com/pluginsGLPI/ocsinventoryng

Source0:        https://github.com/pluginsGLPI/ocsinventoryng/releases/download/%{version}/glpi-ocsinventoryng-%{version}.tar.gz
Source1:        %{name}-httpd.conf

BuildArch:      noarch
BuildRequires:  gettext

%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires:      (glpi >= 9.4 with glpi < 9.5)
%else
Requires:       glpi >= 9.4
Requires:       glpi <  9.5
%endif
Requires:       crontabs
Requires:       php-cli
# phpcompatinfo for version 1.4.0
Requires:       php-simplexml
Requires:       php-date
Requires:       php-json
Requires:       php-mbstring
Requires:       php-pcntl
Requires:       php-pcre
Requires:       php-soap

# Latest version is 1.6.x for GLPI 0.83.x
Obsoletes:      glpi-mass-ocs-import < 1.7
Provides:       glpi-mass-ocs-import = 1.7.0
Provides:       glpi-massocsimport   = 1.7.0


%description
This plugin allows you to synchronize GLPI inventory with OCS Inventory NG.

It's intended to replace native mode OCS of GLPI and use the massocsimport
plugin features to provide better compatibility and extensibility with OCS.


%prep
%setup -q -c

mv %{pluginname}/docs      docs
mv %{pluginname}/README.md docs/

# dos2unix to avoid rpmlint warnings
for doc in docs/* ; do
    sed -i -e 's/\r//' $doc
    chmod -x $doc
done

# Create link to LICENSE for standard doc folder
ln -s %{_datadir}/glpi/plugins/%{pluginname}/LICENSE LICENSE

# For developer only
rm     %{pluginname}/TOKNOW.txt

# For Windows only
rm %{pluginname}/scripts/*.bat

# Access retricted in apache config
rm ocsinventoryng/scripts/.htaccess \
   ocsinventoryng/install/mysql/.htaccess

cat <<EOF | tee cron
# GLPI ocsinventoryng plugin
# Synchronization only of OCS servers in "expert" mode
# Must be enabled from the GLPI Control panel
*/5 * * * * apache %{_datadir}/glpi/plugins/%{pluginname}/scripts/ocsng_fullsync.sh
EOF

# fix perms
find %{pluginname} -type f -exec chmod -x {} \;
chmod +x %{pluginname}/scripts/*.sh

# Display compatibility check
grep version_compare %{pluginname}/setup.php


%build
# Regenerate the locales
for po in %{pluginname}/locales/*.po
do
   msgfmt $po -o $(dirname $po)/$(basename $po .po).mo
done


%install
# Plugin
mkdir -p %{buildroot}/%{_datadir}/glpi/plugins
cp -ar %{pluginname} %{buildroot}/%{_datadir}/glpi/plugins/%{pluginname}

# Apache
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf

# Locales
for i in %{buildroot}/%{_datadir}/glpi/plugins/%{pluginname}/locales/*
do
  lang=$(basename $i)
  echo "%lang(${lang:0:2}) %{_datadir}/glpi/plugins/%{pluginname}/locales/${lang}"
done | tee %{name}.lang

# Cron
install -p -D -m 644 cron %{buildroot}%{_sysconfdir}/cron.d/%{name}

# Lock
mkdir -p %{buildroot}%{_localstatedir}/lib/glpi/files/_lock
touch %{buildroot}%{_localstatedir}/lib/glpi/files/_lock/%{lockname}


%post
# first install (not upgrade)
if [ "$1" -eq "1" ]; then
    install -o apache -g apache -m 644 /dev/null %{_localstatedir}/lib/glpi/files/_lock/%{lockname}
fi


%postun
# uninstall (not upgrade)
if [ "$1" -eq "0" -a -f %{_localstatedir}/lib/glpi/files/_lock/%{lockname} ]; then
    rm %{_localstatedir}/lib/glpi/files/_lock/%{lockname}
fi


%check
# Check consistency for the name of the lock file in sources
grep %{lockname} %{buildroot}/%{_datadir}/glpi/plugins/%{pluginname}/scripts/ocsng_fullsync.sh || exit 1
grep %{lockname} %{buildroot}/%{_datadir}/glpi/plugins/%{pluginname}/setup.php || exit 1


%files -f %{name}.lang
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc docs/*
%config(noreplace) %{_sysconfdir}/cron.d/%{name}
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
%dir %{_datadir}/glpi/plugins/%{pluginname}
%dir %{_datadir}/glpi/plugins/%{pluginname}/locales
%{_datadir}/glpi/plugins/%{pluginname}/*.php
%{_datadir}/glpi/plugins/%{pluginname}/ajax
%{_datadir}/glpi/plugins/%{pluginname}/css
%{_datadir}/glpi/plugins/%{pluginname}/files
%{_datadir}/glpi/plugins/%{pluginname}/front
%{_datadir}/glpi/plugins/%{pluginname}/inc
%{_datadir}/glpi/plugins/%{pluginname}/install
%{_datadir}/glpi/plugins/%{pluginname}/pics
%{_datadir}/glpi/plugins/%{pluginname}/scripts
# Keep here as required from interface
%{_datadir}/glpi/plugins/%{pluginname}/LICENSE
# flag file (empty) used to enable/disable the plugin in the interface (apache)
%ghost %{_localstatedir}/lib/glpi/files/_lock/%{lockname}


%changelog
* Mon Feb 25 2019 Remi Collet <remi@remirepo.net> - 1.6.0-1
- update to 1.6.0 fir GLPI 9.4

* Fri Dec  7 2018 Remi Collet <remi@remirepo.net> - 1.5.6-1
- update to 1.5.6

* Tue Sep 25 2018 Remi Collet <remi@remirepo.net> - 1.5.4-1
- update to 1.5.4

* Mon Sep  3 2018 Remi Collet <remi@remirepo.net> - 1.5.3-1
- update to 1.5.3

* Tue Aug 14 2018 Remi Collet <remi@remirepo.net> - 1.5.2-1
- update to 1.5.2

* Sun Aug 12 2018 Remi Collet <remi@remirepo.net> - 1.5.1-1
- Update to 1.5.1 for GLPI 9.3

* Tue Jul 17 2018 Remi Collet <remi@remirepo.net> - 1.5.0-1
- Update to 1.5.0 for GLPI 9.3

* Wed Jul  4 2018 Remi Collet <remi@remirepo.net> - 1.4.4-1
- Update to 1.4.4 for GLPI 9.2

* Wed Feb 21 2018 Remi Collet <remi@remirepo.net> - 1.4.3-1
- Update to 1.4.3 for GLPI 9.2

* Thu Oct 19 2017 Remi Collet <remi@remirepo.net> - 1.4.2-1
- Update to 1.4.2 for GLPI 9.2

* Thu Oct 19 2017 Remi Collet <remi@remirepo.net> - 1.4.1-1
- Update to 1.4.1 for GLPI 9.2

* Wed Oct 18 2017 Remi Collet <remi@remirepo.net> - 1.4.0-1
- Update to 1.4.0 for GLPI 9.2
- open https://github.com/pluginsGLPI/ocsinventoryng/issues/114
  upgrade is broken

* Mon Jan 16 2017 Remi Collet <remi@fedoraproject.org> - 1.3.2-1
- Update to 1.3.2 for GLPI 9.1.1

* Tue Nov 29 2016 Remi Collet <remi@fedoraproject.org> - 1.3.1-1
- Update to 1.3.1 for GLPI 9.1.1

* Tue Nov 29 2016 Remi Collet <remi@fedoraproject.org> - 1.3.0-1
- Update to 1.3.0 for GLPI 9.1.1
- update script is broken
  open https://github.com/pluginsGLPI/ocsinventoryng/issues/58

* Wed Sep 28 2016 Remi Collet <remi@fedoraproject.org> - 1.2.3-1
- Update to 1.2.3 for GLPI 9.1

* Fri Sep 16 2016 Remi Collet <remi@fedoraproject.org> - 1.2.2-1
- Update to 1.2.2 for GLPI 0.90 and 9.1
- sources from github

* Fri Nov 27 2015 Remi Collet <remi@fedoraproject.org> - 1.2.1-1
- Update to 1.2.1 for GLPI 0.90
  https://forge.glpi-project.org/versions/1181

* Thu Oct  8 2015 Remi Collet <remi@fedoraproject.org> - 1.2.0-1
- Update to 1.2.0 for GLPI 0.90
  https://forge.glpi-project.org/versions/1179

* Wed Sep 16 2015 Remi Collet <remi@fedoraproject.org> - 1.1.2-1
- Update to 1.1.2 for GLPI 0.85+
  https://forge.glpi-project.org/versions/1131

* Mon Jun  8 2015 Remi Collet <remi@fedoraproject.org> - 1.1.1-1
- Update to 1.1.1 for GLPI 0.85+
- add upstream patch for https://forge.indepnet.net/issues/5359

* Sun Mar  1 2015 Remi Collet <remi@fedoraproject.org> - 1.1.0-1
- Update to 1.1.0 for GLPI 0.85+
  https://forge.indepnet.net/versions/1116

* Mon Sep  8 2014 Remi Collet <remi@fedoraproject.org> - 1.0.3-1
- Update to 1.0.3 for GLPI 0.84+
  https://forge.indepnet.net/versions/957

* Wed Oct  2 2013 Remi Collet <remi@fedoraproject.org> - 1.0.2-1
- Initial RPM (from glpi-mass-ocs-import.spec)