forked from apache/ignite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apache-ignite.spec
307 lines (248 loc) · 9.26 KB
/
apache-ignite.spec
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
%define __jar_repack %{nil}
%define user ignite
%define _libdir /usr/lib
%define _log %{_var}/log
%define _sharedstatedir /var/lib
%define _binaries_in_noarch_packages_terminate_build 0
#-------------------------------------------------------------------------------
#
# Packages' descriptions
#
Name: apache-ignite
Version: 2.16.0
Release: 1
Summary: Apache Ignite In-Memory Computing, Database and Caching Platform
Group: Development/System
License: ASL 2.0
URL: https://ignite.apache.org/
Source: %{name}-%{version}-bin.zip
Requires: java-1.8.0, chkconfig
Requires(pre): shadow-utils
Provides: %{name}
AutoReq: no
AutoProv: no
BuildArch: noarch
%description
Ignite™ is a memory-centric distributed database, caching, and processing
platform for transactional, analytical, and streaming workloads, delivering
in-memory speeds at petabyte scale
%prep
#-------------------------------------------------------------------------------
#
# Prepare step: unpack sources
#
%setup -q -n %{name}-%{version}-bin
#%pre
#-------------------------------------------------------------------------------
#
# Preinstall scripts
# $1 can be:
# 1 - Initial install
# 2 - Upgrade
#
%post
#-------------------------------------------------------------------------------
#
# Postinstall scripts
# $1 can be:
# 1 - Initial installation
# 2 - Upgrade
#
echoUpgradeMessage () {
echo "======================================================================================================="
echo " WARNING: Updating Apache Ignite's cluster version requires updating every node before starting grid "
echo "======================================================================================================="
}
setPermissions () {
chown -R %{user}:%{user} %{_sharedstatedir}/%{name} %{_log}/%{name}
}
case $1 in
1|configure)
# DEB postinst upgrade
if [ ! -z "${2}" ]; then
echoUpgradeMessage
fi
# Add user for service operation
useradd -r -d %{_datadir}/%{name} -s /usr/sbin/nologin %{user}
# Change ownership for work and log directories
setPermissions
# Install alternatives
# Commented out until ignitesqlline is ready to work from any user
#update-alternatives --install %{_bindir}/ignitesqlline ignitesqlline %{_datadir}/%{name}/bin/sqlline.sh 0
#update-alternatives --auto ignitesqlline
#update-alternatives --display ignitesqlline
;;
2)
# RPM postinst upgrade
echoUpgradeMessage
# Workaround for upgrade from 2.4.0
if [ -d /usr/com/apache-ignite/ ]; then
for file in /usr/com/apache-ignite/*; do
if [ ! -h $file ]; then
cp -rf $file %{_sharedstatedir}/%{name}/
fi
done
fi
# Change ownership for work and log directories (yum resets permissions on upgrade nevertheless)
setPermissions
;;
esac
%preun
#-------------------------------------------------------------------------------
#
# Pre-uninstall scripts
# $1 can be:
# 0 - Uninstallation
# 1 - Upgrade
#
stopIgniteNodes () {
if ! $(grep -q "Microsoft" /proc/version); then
systemctl stop 'apache-ignite@*'
fi
ps ax | grep '\-DIGNITE_HOME' | head -n-1 | awk {'print $1'} | while read pid; do
kill -INT ${pid}
done
}
case $1 in
0|remove)
# Stop all nodes (both service and standalone)
stopIgniteNodes
# Remove alternatives
# Commented out until ignitesqlline is ready to work from any user
#update-alternatives --remove ignitesqlline /usr/share/%{name}/bin/sqlline.sh
#update-alternatives --display ignitesqlline || true
;;
1|upgrade)
# Stop all nodes (both service and standalone)
echo "=================================================================================="
echo " WARNING: All running Apache Ignite's nodes will be stopped upon package update "
echo "=================================================================================="
stopIgniteNodes
;;
esac
%postun
#-------------------------------------------------------------------------------
#
# Post-uninstall scripts
# $1 can be:
# 0 - Uninstallation
# 1 - Upgrade
#
case $1 in
0|remove)
# Remove user
userdel %{user}
# Remove service PID directory
rm -rfv /var/run/%{name}
# Remove firewalld rules if firewalld is installed and running
if [[ "$(type firewall-cmd &>/dev/null; echo $?)" -eq 0 && "$(systemctl is-active firewalld)" == "active" ]]
then
for port in s d
do
firewall-cmd --permanent --direct --remove-rule ipv4 filter INPUT 0 -p tcp -m multiport --${port}ports 11211:11220,47500:47509,47100:47109 -j ACCEPT &>/dev/null
firewall-cmd --permanent --direct --remove-rule ipv4 filter INPUT 0 -p udp -m multiport --${port}ports 47400:47409 -j ACCEPT &>/dev/null
done
firewall-cmd --permanent --direct --remove-rule ipv4 filter INPUT 0 -m pkttype --pkt-type multicast -j ACCEPT &>/dev/null
systemctl restart firewalld
fi
;;
1|upgrade)
:
;;
esac
%install
#-------------------------------------------------------------------------------
#
# Prepare packages' layout
#
# Create base directory structure
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_libdir}/%{name}
mkdir -p %{buildroot}%{_datadir}/doc/%{name}-%{version}/bin
mkdir -p %{buildroot}%{_log}/%{name}
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}
mkdir -p %{buildroot}%{_sysconfdir}/systemd/system
mkdir -p %{buildroot}%{_bindir}
# Copy nessessary files and remove *.bat files
cp -rf benchmarks bin platforms %{buildroot}%{_datadir}/%{name}
cp -rf docs/* examples %{buildroot}%{_datadir}/doc/%{name}-%{version}
find %{buildroot}%{_datadir}/%{name}/ -name *.bat -exec rm -rf {} \;
# Copy libs to /usr/lib and map them to IGNITE_HOME
cp -rf libs/* %{buildroot}%{_libdir}/%{name}
ln -sf %{_libdir}/%{name} %{buildroot}%{_datadir}/%{name}/libs
# Setup configuration
cp -rf config %{buildroot}%{_sysconfdir}/%{name}
ln -sf %{_sysconfdir}/%{name} %{buildroot}%{_datadir}/%{name}/config
# Setup systemctl service
cp -rf %{_sourcedir}/name.service %{buildroot}%{_sysconfdir}/systemd/system/%{name}@.service
cp -rf %{_sourcedir}/service.sh %{buildroot}%{_datadir}/%{name}/bin/
chmod +x %{buildroot}%{_datadir}/%{name}/bin/service.sh
for file in %{buildroot}%{_sysconfdir}/systemd/system/%{name}@.service %{buildroot}%{_datadir}/%{name}/bin/service.sh
do
sed -i -r -e "s|#name#|%{name}|g" \
-e "s|#user#|%{user}|g" \
${file}
done
# Map work and log directories
ln -sf %{_sharedstatedir}/%{name} %{buildroot}%{_datadir}/%{name}/work
ln -sf %{_log}/%{name} %{buildroot}%{_sharedstatedir}/%{name}/log
%files
#-------------------------------------------------------------------------------
#
# Package file list check
#
%dir %{_datadir}/%{name}
%dir %{_sysconfdir}/%{name}
%dir %{_sharedstatedir}/%{name}
%dir %{_log}/%{name}
%{_datadir}/%{name}/benchmarks
%{_datadir}/%{name}/bin
%{_datadir}/%{name}/config
%{_datadir}/%{name}/libs
%{_datadir}/%{name}/platforms
%{_datadir}/%{name}/work
%{_datadir}/doc/%{name}-%{version}
%{_libdir}/%{name}
%{_sysconfdir}/systemd/system/%{name}@.service
%{_sharedstatedir}/%{name}/log
%config(noreplace) %{_sysconfdir}/%{name}/*
%doc README.txt
%doc NOTICE
%doc RELEASE_NOTES.txt
%doc MIGRATION_GUIDE.txt
%license LICENSE
%changelog
#-------------------------------------------------------------------------------
#
# Changelog
#
* Fri Sep 09 2022 Taras Ledkov <[email protected]> - 2.13.0-1
- Updated Apache Ignite to version 2.14.0
* Thu Apr 07 2022 Nikita Amelchev <[email protected]> - 2.13.0-1
- Updated Apache Ignite to version 2.13.0
* Thu Oct 21 2021 Nikita Amelchev <[email protected]> - 2.12.0-1
- Updated Apache Ignite to version 2.12.0
* Fri Jul 09 2021 Alexey Gidaspov <[email protected]> - 2.11.0-1
- Updated Apache Ignite to version 2.11.0
* Mon Feb 01 2021 Maxim Muzafarov <[email protected]> - 2.10.0-1
- Updated Apache Ignite to version 2.10.0
* Wed Nov 25 2020 Yaroslav Molochkov <[email protected]> - 2.9.1-1
- Updated Apache Ignite to version 2.9.1
* Mon Sep 28 2020 Alexey Plekhanov <[email protected]> - 2.9.0-1
- Updated Apache Ignite to version 2.9.0
* Wed May 20 2020 Nikolay Izhikov <[email protected]> - 2.8.1-1
- Updated Apache Ignite to version 2.8.1
* Thu Feb 20 2020 Maxim Muzafarov <[email protected]> - 2.8.0-1
- Updated Apache Ignite to version 2.8.0
* Tue Sep 10 2019 Peter Ivanov <[email protected]> - 2.7.6-1
- Updated Apache Ignite to version 2.7.6
* Fri Apr 12 2019 Peter Ivanov <[email protected]> - 2.7.5-1
- Updated Apache Ignite to version 2.7.5
* Thu Jul 26 2018 Peter Ivanov <[email protected]> - 2.7.0-1
- Updated Apache Ignite to version 2.7.0
* Fri Jun 15 2018 Peter Ivanov <[email protected]> - 2.6.0-1
- Updated Apache Ignite to version 2.6.0
* Tue Apr 17 2018 Peter Ivanov <[email protected]> - 2.5.0-1
- Updated Apache Ignite to version 2.5.0
* Wed Jan 17 2018 Peter Ivanov <[email protected]> - 2.4.0-1
- Initial package release