From 7a3498ab7fdc181eb880c5033270349829500945 Mon Sep 17 00:00:00 2001
From: Felix Dreissig <f30@f30.me>
Date: Fri, 7 Oct 2016 12:05:31 +0200
Subject: [PATCH] Restore environment variable used by command line tools
 (#839184)

The "JAVA" environment variable cannot be used with systemd, but is
required for zkCli.sh, zkCleanup.sh and zkServer.sh. zkServer.sh
also uses "$ZOOCFGDIR".
---
 debian/conf_example/environment  | 5 +++++
 debian/zookeeperd.zookeeper.init | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/debian/conf_example/environment b/debian/conf_example/environment
index cbd8404..b84918c 100644
--- a/debian/conf_example/environment
+++ b/debian/conf_example/environment
@@ -1,10 +1,15 @@
 ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
+ZOOCFGDIR=/etc/zookeeper/conf
 ZOOCFG=/etc/zookeeper/conf/zoo.cfg
 ZOO_LOG_DIR=/var/log/zookeeper
 ZOO_LOG4J_PROP=INFO,ROLLINGFILE
 JMXLOCALONLY=false
 JAVA_OPTS=""
 
+# If ZooKeeper is started through systemd, this will only be used for command
+# line tools such as `zkCli.sh` and not for the actual server
+JAVA=/usr/bin/java
+
 # TODO: This is really ugly
 # How to find out which jars are needed?
 # Seems that log4j requires the log4j.properties file to be in the classpath
diff --git a/debian/zookeeperd.zookeeper.init b/debian/zookeeperd.zookeeper.init
index b596cd4..ea25c00 100644
--- a/debian/zookeeperd.zookeeper.init
+++ b/debian/zookeeperd.zookeeper.init
@@ -31,7 +31,6 @@ DESC="Coordination service for distributed applications"
 NAME=zookeeper
 USER=$NAME
 GROUP=$NAME
-JAVA=/usr/bin/java
 PIDDIR="/var/run/$NAME"
 PIDFILE="$PIDDIR/$NAME.pid"
 SCRIPTNAME="/etc/init.d/$NAME"
-- 
2.9.3

