forked from softwarefactory-project/zookeeper-lite-distgit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zookeeper-lite.spec
136 lines (96 loc) · 4.33 KB
/
zookeeper-lite.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
Name: zookeeper-lite
Version: 3.4.10
Release: 3%{?dist}
Summary: A lite version of the zookeeper service, without the clients, bindings or netty.
License: ASL 2.0 and BSD
URL: https://zookeeper.apache.org/
Source0: https://www.apache.org/dist/zookeeper/zookeeper-%{version}/zookeeper-%{version}.tar.gz
Source1: zookeeper.service
Source2: pom.template
Source3: zookeeper.sh
Source4: log4j.properties
BuildRequires: ant
BuildRequires: systemd
BuildRequires: log4j
BuildRequires: jline
BuildRequires: slf4j
Requires: java-1.8.0-openjdk
Requires: log4j
Requires: jline
Requires: slf4j
Requires: wait4service
Provides: zookeeper
%description
ZooKeeper is a centralized service for maintaining configuration information,
naming, providing distributed synchronization, and providing group services.
%prep
%autosetup -n zookeeper-%{version}
# Remove bundled stuff
find -name "*.jar" -o -name "*.class" -delete
# Disable netty
rm ./src/java/main/org/apache/zookeeper/server/NettyServerCnxn*
# Disable Log4jMBeans, otherwise build fails with:
# [javac] src/java/main/org/apache/zookeeper/jmx/ManagedUtil.java:61: error: cannot find symbol
# [javac] LoggerRepository r = LogManager.getLoggerRepository();
cat <<EOF> src/java/main/org/apache/zookeeper/jmx/ManagedUtil.java
package org.apache.zookeeper.jmx;
import javax.management.JMException;
public class ManagedUtil {
public static void registerLog4jMBeans() throws JMException { return; }
}
EOF
# Remove ivy task
sed -i 's|depends="ivy-retrieve,|depends="|' build.xml
# Fix missing hostname
sed -i 's|<exec executable="hostname" outputproperty="host.name"/>|<!--exec executable="hostname" outputproperty="host.name"/-->|' build.xml
sed -i 's|<attribute name="Built-On" value="${host.name}" />|<attribute name="Built-On" value="${user.name}" />|' build.xml
# Force the use of local libraries
sed -i 's|<path id="java.classpath">|<path id="java.classpath"><fileset dir="/usr/share/java"><include name="*.jar" /></fileset>|' build.xml
sed -i 's|<path id="java.classpath">|<path id="java.classpath"><fileset dir="/usr/share/java/slf4j"><include name="*.jar" /></fileset>|' build.xml
# Fix datadir
sed -i 's|dataDir=/tmp/zookeeper|dataDir=/var/lib/zookeeper|' conf/zoo_sample.cfg
# Add missing pom
cp %{SOURCE2} src/
%build
%ant jar
%install
install -p -D -m 644 build/zookeeper-%{version}.jar %{buildroot}%{_javadir}/zookeeper.jar
install -d -m 755 %{buildroot}%{_sysconfdir}/zookeeper
install -p -D -m 644 conf/configuration.xsl %{SOURCE4} %{buildroot}%{_sysconfdir}/zookeeper
install -p -D -m 644 conf/zoo_sample.cfg %{buildroot}%{_sysconfdir}/zookeeper/zoo.cfg
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/zookeeper.service
install -p -D -m 755 %{SOURCE3} %{buildroot}%{_libexecdir}/zookeeper
install -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig/
echo "CLASSPATH=$(build-classpath jline log4j):/usr/share/java/slf4j/slf4j-api.jar:/usr/share/java/slf4j/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar" > %{buildroot}%{_sysconfdir}/sysconfig/zookeeper
echo "ZK_HEAP_LIMIT=2g" >> %{buildroot}%{_sysconfdir}/sysconfig/zookeeper
install -d -m 750 %{buildroot}%{_localstatedir}/log/zookeeper
install -d -m 750 %{buildroot}%{_sharedstatedir}/zookeeper
%pre
getent group zookeeper > /dev/null || groupadd -r zookeeper
getent passwd zookeeper > /dev/null || useradd -r -g zookeeper \
-d %{_sharedstatedir}/zookeeper -s /sbin/nologin \
-c "ZooKeeper service account" zookeeper
exit 0
%post
%systemd_post zookeeper.service
%preun
%systemd_preun zookeeper.service
%postun
%systemd_postun_with_restart zookeeper.service
%files
%{_javadir}/zookeeper.jar
%{_sysconfdir}/zookeeper
%{_sysconfdir}/sysconfig/zookeeper
%{_unitdir}/zookeeper.service
%{_libexecdir}/zookeeper
%attr(0750,zookeeper,zookeeper) %dir %{_localstatedir}/log/zookeeper
%attr(0700,zookeeper,zookeeper) %dir %{_sharedstatedir}/zookeeper
%changelog
* Mon Nov 06 2017 Tristan Cacqueray <[email protected]> 3.4.10-3
- Add better log4j properties and zookeeper libexec script
* Tue Sep 05 2017 Tristan Cacqueray <[email protected]> 3.4.10-2
- Change zookeeper.service mode to 644
* Fri Jun 02 2017 Tristan Cacqueray <[email protected]> 3.4.10-1
- Bump to 3.4.10 to fix CVE-2017-5637
* Mon Feb 20 2017 Tristan Cacqueray <[email protected]> 3.4.9-1
- First package