This repository has been archived by the owner on Oct 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
thumbslug.spec
434 lines (351 loc) · 14.9 KB
/
thumbslug.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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
%global _binary_filedigest_algorithm 1
%global _source_filedigest_algorithm 1
%global _binary_payload w9.gzdio
%global _source_payload w9.gzdio
%global selinux_variants mls strict targeted
%global modulename thumbslug
%global use_systemd (0%{?fedora} && 0%{?fedora} >= 17) || (0%{?rhel} && 0%{?rhel} >= 7)
%if %use_systemd
%global selinux_policy_dir systemd
%else
%global selinux_policy_dir sysvinit
%endif
Name: thumbslug
Summary: Thumbslug CDN proxy
Group: Internet/Applications
License: GPLv2
Version: 0.0.40
Release: 1%{?dist}
URL: http://fedorahosted.org/thumbslug
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Vendor: Red Hat, Inc.
BuildArch: noarch
Requires(pre): shadow-utils
Requires: apache-commons-codec-eap6
%if 0%{?fedora}
Requires: java-oauth
%else
Requires: oauth >= 20100601-4
%endif
Requires: jna >= 3.2.4
Requires: log4j >= 1.2
Requires: netty >= 3.2.3
Requires: akuma >= 1.7
Requires: java >= 1.6.0
Requires: jpackage-utils
%if %use_systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts
%endif
# BuildRequires section
BuildRequires: ant >= 1.7.0
BuildRequires: akuma >= 1.7
BuildRequires: jna >= 3.2.4
BuildRequires: log4j >= 1.2
BuildRequires: netty >= 3.2.3
BuildRequires: apache-commons-codec-eap6
%if 0%{?fedora}
BuildRequires: java-oauth
%else
BuildRequires: oauth >= 20100601-4
%endif
BuildRequires: java-devel >= 1.6.0
BuildRequires: jpackage-utils
%if %use_systemd
# We need the systemd RPM macros
BuildRequires: systemd
%endif
%define __jar_repack %{nil}
%description
Thumbslug is a content and entitlement proxy for on premesis Candlepin installs.
%package selinux
Summary: SELinux policy module supporting thumbslug
Group: System Environment/Base
BuildRequires: checkpolicy
BuildRequires: selinux-policy-devel
BuildRequires: /usr/share/selinux/devel/policyhelp
BuildRequires: hardlink
%{!?_selinux_policy_version: %global _selinux_policy_version %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp 2>/dev/null)}
%if "%{_selinux_policy_version}" != ""
Requires: selinux-policy >= %{_selinux_policy_version}
%endif
Requires: %{name} = %{version}-%{release}
Requires(post): /usr/sbin/semodule
Requires(post): /usr/sbin/semanage
Requires(post): /sbin/restorecon
Requires(postun): /usr/sbin/semodule
Requires(postun): /usr/sbin/semanage
Requires(postun): /sbin/restorecon
%description selinux
%{summary}.
%prep
%setup -q
%{__mkdir} -p lib
build-jar-repository -s -p lib oauth/oauth-consumer oauth/oauth akuma commons-codec-eap6/commons-codec jna log4j netty
%build
ant -Dlibdir=lib clean package
pushd selinux/%{selinux_policy_dir}
for selinuxvariant in %{selinux_variants}
do
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
mv %{modulename}.pp %{modulename}.pp.${selinuxvariant}
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
done
popd
%install
install -d -m 755 %{buildroot}/%{_javadir}
install -m 644 target/%{name}.jar %{buildroot}/%{_javadir}/%{name}.jar
install -d -m 755 %{buildroot}/%{_bindir}/
%if %use_systemd
install -d -m 755 %{buildroot}/%{_unitdir}
install -m 644 conf/%{name}.service %{buildroot}/%{_unitdir}/%{name}.service
install -d -m 755 %{buildroot}/%{_tmpfilesdir}
install -m 644 conf/%{name}.conf.tmpfiles %{buildroot}/%{_tmpfilesdir}/%{name}.conf
%else
install -d -m 755 %{buildroot}/%{_initddir}
install -m 755 conf/thumbslug.init %{buildroot}/%{_initddir}/%{name}
%endif
install -d -m 755 %{buildroot}/%{_sysconfdir}/thumbslug
install -m 640 conf/thumbslug.conf \
%{buildroot}/%{_sysconfdir}/thumbslug/thumbslug.conf
install -m 640 cdn-ca.pem \
%{buildroot}/%{_sysconfdir}/thumbslug/cdn-ca.pem
install -d -m 775 %{buildroot}/%{_var}/log/%{name}
install -d -m 775 %{buildroot}/%{_var}/run/%{name}
install -d -m 775 %{buildroot}/%{_var}/lock/subsys
/bin/touch %{buildroot}/%{_var}/run/%{name}/%{name}.pid
/bin/touch %{buildroot}/%{_var}/lock/subsys/%{name}
%jpackage_script org.candlepin.thumbslug.Main "" "" %{name}:oauth/oauth:oauth/oauth-consumer:akuma:commons-codec-eap6/commons-codec:jna:log4j:netty %{name} true
pushd selinux/%{selinux_policy_dir}
for selinuxvariant in %{selinux_variants}
do
install -d %{buildroot}/%{_datadir}/selinux/${selinuxvariant}
install -p -m 644 %{modulename}.pp.${selinuxvariant} \
%{buildroot}/%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp
done
popd
/usr/sbin/hardlink -cv %{buildroot}/%{_datadir}/selinux
%clean
rm -rf %{buildroot}
%pre
getent group thumbslug >/dev/null || groupadd -r thumbslug
getent passwd thumbslug >/dev/null || \
useradd -r -g thumbslug -d %{_datadir}/%{name} -s /sbin/nologin \
-c "thumbslug content and entitlement proxy" thumbslug
exit 0
%post
%if %use_systemd
%systemd_post %{name}.service
%else
/sbin/chkconfig --add %{name}
%endif
%postun
%if %use_systemd
%systemd_postun_with_restart %{name}.service
%else
if [ "$1" -ge "1" ] ; then
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
fi
%endif
%preun
%if %use_systemd
%systemd_preun %{name}.service
%else
if [ $1 -eq 0 ] ; then
/sbin/service %{name} stop >/dev/null 2>&1
/sbin/chkconfig --del %{name}
fi
%endif
%post selinux
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -i \
%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || :
done
/usr/sbin/semanage port -a -t thumbslug_port_t -p tcp 8088 &> /dev/null || :
%postun selinux
if [ $1 -eq 0 ] ; then
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || :
done
/usr/sbin/semanage port -d -t thumbslug_port_t -p tcp 8088 &> /dev/null || :
fi
%files
%defattr(-, root, thumbslug)
%doc README
%if %use_systemd
%attr(644,root,root) %{_unitdir}/%{name}.service
%attr(644,root,root) %{_tmpfilesdir}/%{name}.conf
%else
%attr(755,root,root) %{_initrddir}/%{name}
%endif
%attr(-, root, root) %{_bindir}/%{name}
%dir %{_sysconfdir}/thumbslug
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%{_sysconfdir}/%{name}/cdn-ca.pem
%{_javadir}/%{name}.jar
%dir %{_var}/log/%{name}
%dir %{_var}/run/%{name}
%ghost %attr(644, thumbslug, thumbslug) %{_var}/run/%{name}/%{name}.pid
%ghost %attr(644, thumbslug, thumbslug) %{_var}/lock/subsys/%{name}
%files selinux
%defattr(-,root,root,0755)
%doc selinux/*
%{_datadir}/selinux/*/%{modulename}.pp
%changelog
* Fri Jul 11 2014 Devan Goodwin <[email protected]> 0.0.40-1
- Use correct apache-commons-codec package, remove EL5 jakarta deps.
* Tue Apr 01 2014 Alex Wood <[email protected]> 0.0.39-1
- Revert "Update condition to <= 6 for proper build package" ([email protected])
- Build against newer oauth packaging. ([email protected])
* Thu Feb 27 2014 William Poteat <[email protected]> 0.0.38-1
- Correct requires and buildrequires for oauth and use macros correctly.
* Wed Feb 26 2014 William Poteat <[email protected]> 0.0.37-1
- 918759: Update Thumbslug to use systemd. ([email protected])
* Fri Sep 13 2013 William Poteat <[email protected]> 0.0.36-1
- Update condition to <= 6 for proper build package ([email protected])
* Fri Sep 13 2013 William Poteat <[email protected]> 0.0.35-1
- 910077: Removed offending Shutting down log statement. ([email protected])
* Tue Sep 03 2013 jesus m. rodriguez <[email protected]> 0.0.34-1
- 924349: semanage changes ([email protected])
- 924349: remove restorecon /var/cache/thumbslug ([email protected])
- 996681: be less specific with thumbslug ([email protected])
- remove f16 and f17 from katello-koji releasers ([email protected])
- remove cvs section from tito.props ([email protected])
* Wed Aug 21 2013 jesus m. rodriguez <[email protected]> 0.0.33-1
- 996681: Change default group owner ([email protected])
* Mon Jun 03 2013 Bryan Kearney <[email protected]> 0.0.32-1
- Update spec file to only use jakarta-commons-codec on RHEL 5
* Thu Mar 28 2013 Alex Wood <[email protected]> 0.0.31-1
- Fix PKCS8 private key parsing from recent fix. ([email protected])
- Checkstyle fixes. ([email protected])
- 916895: Fix use of V3 certificates to the CDN. ([email protected])
- Add note on how to generate server keystore. ([email protected])
* Tue Mar 12 2013 jesus m. rodriguez <[email protected]> 0.0.30-1
- RHEL 5 and 6 require jakarta-commons-codec. ([email protected])
* Wed Feb 20 2013 jesus m. rodriguez <[email protected]> 0.0.29-1
- F18 has java-oauth ([email protected])
- f17 file should use f17 and *not* f15 ([email protected])
- add f18 build configs ([email protected])
- add releaser for katello-koji to build into katello-thirdparty-candlepin* tag ([email protected])
* Wed Dec 19 2012 jesus m. rodriguez <[email protected]> 0.0.28-1
- require apache-commons-codec instead of jakarta-commons-codec ([email protected])
- 880662: Add missing semanage dep for selinux pkg ([email protected])
* Thu Nov 15 2012 James Bowes <[email protected]> 0.0.27-1
- 875876: Fix oauth classpath in init script ([email protected])
- 871586: Add a ping function to Thumbslug. ([email protected])
- 817599: Fix closing connections when in a bad state ([email protected])
- 865841: Improve concurrency properties of thumbslug ([email protected])
- 829791: Add support for configuring logging in thumbslug.conf
* Fri Nov 02 2012 William Poteat <[email protected]> 0.0.26-1
- Add findbugs target ([email protected])
- 868290: Verify signature on client and CDN X.509 certificates
- Target java 1.6 ([email protected])
- Go back to a megajar for use with the buildfile ([email protected])
- Allow Thumbslug to operate with V3 entitlement certs ([email protected])
- adding internal koji repo ([email protected])
- Add back 5Server and 6Server ([email protected])
- update releasers to f17 ([email protected])
- include require for emma so emma target works ([email protected])
* Wed Jul 11 2012 Chris Duryee (beav) <[email protected]>
- 837386: do not package jars with thumbslug ([email protected])
- fixups for ruby 1.9 and java 1.7 ([email protected])
- adding test config with fake values to test Config ([email protected])
* Tue May 08 2012 Chris Duryee (beav) <[email protected]>
- 819662: missing default for cdn.proxy value ([email protected])
* Wed Apr 25 2012 Chris Duryee (beav) <[email protected]>
- Initial proxy support for thumbslug ([email protected])
- Exclude manifest.mf files for sub-jars from being included in thumbslug.jar
- print shutdown message during error conditions ([email protected])
* Mon Apr 09 2012 Chris Duryee (beav) <[email protected]>
- just build x86_64 in fedora for now ([email protected])
- jar inclusion and log fix ([email protected])
- do not package the jar if deps are missing ([email protected])
- 790802: thumbslug deps not built in brew ([email protected])
- Rework try/catch block on config file reading ([email protected])
- Modify the mock target to use the mirror lists ([email protected])
* Wed Dec 21 2011 Bryan Kearney <[email protected]> 0.0.21-1
- Add initial selinux policy ([email protected])
- 759598: teach thumbslug init how to show status and stop ([email protected])
- bunch of minor whitespace cleanup ([email protected])
- remove all trailing whitespace, configure checkstyle to verify.
- add emma tasks to buildfile for code coverage ([email protected])
* Tue Dec 06 2011 James Bowes <[email protected]> 0.0.20-1
- Fix accept type and order of operations for candlepin communication
* Mon Dec 05 2011 James Bowes <[email protected]> 0.0.19-1
- 759607: update url for subscriptions handler ([email protected])
- update readme to reference changing rhsm ca certs ([email protected])
- Check entitlement against candlepin to ensure it is not revoked
* Mon Nov 28 2011 James Bowes <[email protected]> 0.0.18-1
- Add chkconfig initscript lines ([email protected])
* Wed Nov 23 2011 James Bowes <[email protected]> 0.0.17-1
- add rpm scriptlets for init script ([email protected])
- add a note about client configuration in the readme ([email protected])
- update to latest akuma ([email protected])
- change lock file ([email protected])
- print ssl error to log file ([email protected])
- fix ant packaging ([email protected])
- add restart and status init targets ([email protected])
- Add config file for etc ([email protected])
- Set up thumbslug user ([email protected])
- update spec to install init file ([email protected])
- Allow overriding config values from thumbslug.conf ([email protected])
- fill in spec description ([email protected])
- update config documentation ([email protected])
* Wed Nov 16 2011 jesus m. rodriguez <[email protected]> 0.0.16-1
- ibiblio moved. ([email protected])
* Wed Nov 16 2011 jesus m. rodriguez <[email protected]> 0.0.15-1
- Support downloading entitlement certificates from candlepin ([email protected])
- Switch to PEM format files for thumbslug to CDN connection ([email protected])
* Wed Oct 26 2011 jesus m. rodriguez <[email protected]> 0.0.14-1
- respin thumbslug ([email protected])
* Tue Oct 25 2011 jesus m. rodriguez <[email protected]> 0.0.13-1
- WIP ts -> candlepin code for chris to pick up ([email protected])
- remove TODO about getSink ([email protected])
- add testing servlets for spec tests ([email protected])
- use correct dist-cvs branch ([email protected])
- Don't bother encoding/decoding the request/response bodies ([email protected])
* Tue Oct 11 2011 jesus m. rodriguez <[email protected]> 0.0.12-1
- adding proper branch ([email protected])
* Tue Oct 11 2011 jesus m. rodriguez <[email protected]> 0.0.11-1
- allow dist-cvs building ([email protected])
* Mon Oct 10 2011 jesus m. rodriguez <[email protected]> 0.0.10-1
- update gitignore ([email protected])
- checkstyle fixup ([email protected])
* Wed Jul 13 2011 Chris Duryee (beav) <[email protected]>
- ant jar stuff ([email protected])
- Merge commit 'ed410d78475813f9bd8e28530408c60280c7a000' ([email protected])
- first cut at a thumbslug init file ([email protected])
* Tue Jul 12 2011 Chris Duryee (beav) <[email protected]>
- pull the jar into the rpm ([email protected])
* Tue Jul 12 2011 Chris Duryee (beav) <[email protected]>
- make the jar file have a consistent name ([email protected])
* Tue Jul 12 2011 Chris Duryee (beav) <[email protected]>
- dont generate schema (we dont have any) ([email protected])
* Tue Jul 12 2011 Chris Duryee (beav) <[email protected]>
- include ant ([email protected])
* Mon Jul 11 2011 Chris Duryee (beav) <[email protected]>
- try to make an rpm ([email protected])
* Mon Jul 11 2011 Chris Duryee (beav) <[email protected]>
- bump the version
* Mon Jul 11 2011 Chris Duryee (beav) <[email protected]>
- new package built with tito
* Mon Jul 11 2011 Chris Duryee <[email protected]> 0.0.1-1
- first cut ([email protected])