Browse code

Add zookeeper to systemd service. Remove unused sysv file from xinetd.

Change-Id: I43840d0711952e9fa5c7e03c87a7b6a84f30ada9
Reviewed-on: http://photon-jenkins.eng.vmware.com/146
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: Mahmoud Bassiouny <mbassiouny@vmware.com>

xiaolin-vmware authored on 2015/11/18 02:24:37
Showing 2 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:  	xinetd -- A better inetd.
2 2
 Name:		xinetd
3 3
 Version:	2.3.15
4
-Release:	1%{?dist}
4
+Release:	2%{?dist}
5 5
 License:	BSD
6 6
 Group:		System Environment/Daemons
7 7
 Vendor:     	VMware, Inc.
... ...
@@ -34,7 +34,6 @@ mkdir -p %{buildroot}/etc/rc.d/init.d
34 34
 mkdir -p %{buildroot}/etc/xinetd.d
35 35
 
36 36
 %makeinstall  
37
-install -m 0755 contrib/xinetd %{buildroot}/etc/rc.d/init.d/xinetd
38 37
 install -m 0600 contrib/xinetd.conf %{buildroot}/etc/
39 38
 cp contrib/xinetd.d/* %{buildroot}/etc/xinetd.d
40 39
 mkdir -p %{buildroot}/lib/systemd/system
... ...
@@ -59,12 +58,13 @@ fi
59 59
 %doc CHANGELOG COPYRIGHT README xinetd/sample.conf contrib/empty.conf 
60 60
 %{_sbindir}/*
61 61
 %{_datadir}/man/*/*
62
-%attr(0750, root, root) %config(noreplace) /etc/rc.d/init.d/xinetd
63 62
 %attr(0750, root, root) %config(noreplace) /etc/xinetd.conf
64 63
 %attr(0750, root, root) %config(noreplace) /etc/xinetd.d/*
65 64
 /lib/systemd/system/xinetd.service
66 65
 
67 66
 %changelog
67
+*   Thu Dec 03 2015 Xiaolin Li  <xiaolinl@vmware.com> 2.3.15-2
68
+-   Remove rc files
68 69
 *   Fri Aug 07 2015 Xiaolin Li  <xiaolinl@vmware.com> 2.3.15-1
69 70
 -   Add xinetd library to photon
70 71
 *   Sun Sep 07 2003 Steve Grubb <linux_4ever@yahoo.com>
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Highly reliable distributed coordination
2 2
 Name:		zookeeper
3 3
 Version:	3.4.6
4
-Release:	4%{?dist}
4
+Release:	5%{?dist}
5 5
 URL:		http://zookeeper.apache.org/
6 6
 License:	Apache License, Version 2.0
7 7
 Group:		Applications/System
... ...
@@ -38,12 +38,34 @@ cp conf/zoo_sample.cfg %{buildroot}%{_prefix}/share/zookeeper/templates/conf/zoo
38 38
 chmod 0755 %{buildroot}/sbin/*
39 39
 chmod 0755 %{buildroot}/etc/rc.d/init.d/zookeeper
40 40
 
41
+sed -i 's/.*ZOOBINDIR.*\/etc.*/    ZOOBINDIR=\/etc\/zookeeper/g' bin/zkEnv.sh
41 42
 mv bin/* %{buildroot}%{_bindir}
42 43
 mv lib/* %{buildroot}%{_libdir}
43 44
 mv conf/zoo_sample.cfg %{buildroot}%{_sysconfdir}/zookeeper/zoo.cfg
44 45
 mv conf/* %{buildroot}%{_sysconfdir}/zookeeper
45
-cd ..
46
+pushd ..
46 47
 rm -rf %{buildroot}/%{name}-%{version}
48
+popd
49
+
50
+mkdir -p %{buildroot}/lib/systemd/system
51
+cat << EOF >> %{buildroot}/lib/systemd/system/zookeeper.service
52
+[Unit]
53
+Description=Apache ZooKeeper
54
+After=network.target
55
+ConditionPathExists=/etc/zookeeper/zoo.cfg
56
+
57
+[Service]
58
+Type=forking
59
+ExecStart=/usr/bin/zkServer.sh start /etc/zookeeper/zoo.cfg
60
+ExecStop=/usr/bin/zkServer.sh stop
61
+User=zookeeper
62
+Group=hadoop
63
+Restart=always
64
+RestartSec=30
65
+
66
+[Install]
67
+WantedBy=multi-user.target
68
+EOF
47 69
 
48 70
 %pre
49 71
 getent group hadoop 2>/dev/null >/dev/null || /usr/sbin/groupadd -r hadoop
... ...
@@ -57,7 +79,12 @@ bash %{_prefix}/sbin/update-zookeeper-env.sh \
57 57
        --log-dir=%{_var}/log/zookeeper \
58 58
        --pid-dir=%{_var}/run \
59 59
        --var-dir=%{_var}/zookeeper
60
-/sbin/ldconfig
60
+%{_sbindir}/ldconfig 
61
+if [ $1 -eq 1 ] ; then
62
+    # Initial installation
63
+    # Enabled by default per "runs once then goes away" exception
64
+    /bin/systemctl enable zookeeper.service || :
65
+fi
61 66
 
62 67
 %preun
63 68
 source %{_sysconfdir}/profile.d/java-exports.sh
... ...
@@ -68,6 +95,7 @@ bash %{_prefix}/sbin/update-zookeeper-env.sh \
68 68
        --pid-dir=%{_var}/run \
69 69
        --var-dir=%{_var}/zookeeper \
70 70
        --uninstall
71
+/bin/systemctl disable zookeeper.service
71 72
 
72 73
 %postun
73 74
 /usr/sbin/userdel zookeeper
... ...
@@ -80,9 +108,12 @@ bash %{_prefix}/sbin/update-zookeeper-env.sh \
80 80
 %attr(0775,root,hadoop) /etc/rc.d/init.d/zookeeper
81 81
 %attr(0775,root,hadoop) /sbin/update-zookeeper-env.sh
82 82
 %config(noreplace) %{_sysconfdir}/zookeeper/*
83
+/lib/systemd/system/zookeeper.service
83 84
 %{_prefix}
84 85
 
85 86
 %changelog
87
+* Wed Nov 18 2015 Xiaolin Li <xiaolinl@vmware.com> 3.4.6-5
88
+- Add zookeeper to systemd service.
86 89
 * Tue Nov 10 2015 Mahmoud Bassiouny<mbassiouny@vmware.com> 3.4.6-4
87 90
 - Fix conflicts between zookeeper and chkconfig
88 91
 * Wed Sep 16 2015 Harish Udaiya Kumar<hudaiyakumar@vmware.com> 3.4.6-3