forked from boogieshafer/jetty-solr-rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjetty-solr.spec
105 lines (90 loc) · 2.97 KB
/
jetty-solr.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
%define _prefix /var/lib/solr
%define _logprefix /var/log/solr
%define _javaprefix /usr/lib/jvm
Name: jetty-solr
Version: %{ver}
Release: 9%{?dist}
Summary: Solr
License: GPL
URL: http://lucene.apache.org/solr/
Source: http://apache.mirrors.lucidnetworks.net/lucene/solr/%{version}/solr-%{version}.tgz
Source1: jetty
Source2: jetty-solr
Source3: jetty-logging.xml
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires(pre): shadow-utils
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts
Requires: java-1.7.0-openjdk
%description
%{summary}
%prep
%setup -q -n solr-%{version}
%build
%install
rm -rf $RPM_BUILD_ROOT
%__install -d "%{buildroot}%{_prefix}"
cp -p *.txt "%{buildroot}%{_prefix}"
cp -pr contrib "%{buildroot}%{_prefix}"
cp -pr dist "%{buildroot}%{_prefix}"
cp -pr docs "%{buildroot}%{_prefix}"
%__install -d "%{buildroot}%{_prefix}/jetty-solr"
cp -pr example/* "%{buildroot}%{_prefix}/jetty-solr"
cp -pr licenses "%{buildroot}%{_prefix}"
%__install -d "%{buildroot}%{_prefix}"/jetty-solr/solr/data
%__install -d "%{buildroot}%{_prefix}"/jetty-solr/solr/lib
%__install -d "%{buildroot}"/etc/default
%__install -d "%{buildroot}"/etc/init.d
%__install -d "%{buildroot}%{_logprefix}"
%__install -D -m0644 "%{SOURCE1}" %{buildroot}/etc/default/jetty
%__install -D -m0755 "%{SOURCE2}" %{buildroot}/etc/init.d/jetty-solr
%__install -D -m0644 "%{SOURCE3}" %{buildroot}%{_prefix}/jetty-solr/etc/jetty-logging.xml
sed -i "s|JETTY_HOME_REPLACE|%{_prefix}|g" "%{buildroot}/etc/default/jetty"
sed -i "s|JETTY_LOGS_REPLACE|%{_logprefix}|g" "%{buildroot}/etc/default/jetty"
sed -i "s|JAVA_HOME_REPLACE|%{_javaprefix}|g" "%{buildroot}/etc/default/jetty"
sed -i "s|./logs/|%{_logprefix}|g" "%{buildroot}%{_prefix}/jetty-solr/etc/logging.properties"
sed -i "s|logs/|%{_logprefix}|g" "%{buildroot}%{_prefix}/jetty-solr/etc/jetty.xml"
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,solr,solr,-)
%attr(0755,solr,solr) %dir %{_prefix}
%attr(0755,solr,solr) %dir %{_logprefix}
%doc
%{_prefix}/contrib
%{_prefix}/dist
%{_prefix}/docs
%{_prefix}/jetty-solr
%{_prefix}/licenses
%{_prefix}/CHANGES.txt
%{_prefix}/LICENSE.txt
%{_prefix}/NOTICE.txt
%{_prefix}/README.txt
%{_prefix}/SYSTEM_REQUIREMENTS.txt
%attr(0755,root,root) /etc/init.d/jetty-solr
%attr(0644,root,root) /etc/default/jetty
%pre
getent group solr >/dev/null || groupadd -r solr
getent passwd solr >/dev/null || \
useradd -r -g solr -d %{_prefix} -s /bin/bash \
-c "Solr User" solr
exit 0
%post
chkconfig --add jetty-solr
echo "Installation complete."
%preun
if [ $1 = 0 ] ; then
service jetty-solr stop >/dev/null 2>&1 || :
chkconfig --del jetty-solr
fi
%postun
if [ "$1" -ge "1" ] ; then
service jetty-solr restart >/dev/null 2>&1 || :
fi
%changelog
* Tue Jan 29 2013 Boogie Shafer <[email protected]>
- edits for 4.1.0 solr using bundled jetty and zookeeper
* Tue Jan 18 2012 Jean-Francois Roche <[email protected]>
- Initial implementation