Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jan 2016 15:42:56 +0000 (UTC)
From:      Steven Kreuzer <skreuzer@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r405460 - head/devel/zookeeper/files
Message-ID:  <201601071542.u07FguKu043799@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: skreuzer
Date: Thu Jan  7 15:42:56 2016
New Revision: 405460
URL: https://svnweb.freebsd.org/changeset/ports/405460

Log:
  Upgrade to version 3.4.7
  
  Update the port to honor localbase instead of installing everything under
  /usr/local/zookeeper
  
  Make use of freebsd ports for dependencies instead of installing copies
  provided by the distfile

Added:
  head/devel/zookeeper/files/zkCli.sh.in   (contents, props changed)
  head/devel/zookeeper/files/zkServer.sh.in   (contents, props changed)
Modified:
  head/devel/zookeeper/files/zookeeper.in

Added: head/devel/zookeeper/files/zkCli.sh.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/zookeeper/files/zkCli.sh.in	Thu Jan  7 15:42:56 2016	(r405460)
@@ -0,0 +1,23 @@
+#!/bin/sh
+# $FreeBSD$
+
+zookeeper_log4jpropfile="file:%%ETCDIR%%/log4j.properties"
+zookeeper_rootlogger="WARN,CONSOLE"
+zookeeper_logdir="%%ZOOKEEPER_LOGDIR%%"
+
+JAVA=%%JAVA%%
+JAVAJARDIR=%%JAVAJARDIR%%
+
+for i in zookeeper jline slf4j-api netty log4j
+do
+    CLASSPATH="${JAVAJARDIR}/$i.jar:$CLASSPATH"
+done
+CLASSPATH=/usr/local/share/slf4j/slf4j-log4j12.jar:$CLASSPATH
+
+zookeeper_main="org.apache.zookeeper.ZooKeeperMain"
+log4j_params="-Dzookeeper.log.dir=${zookeeper_logdir} \
+            -Dzookeeper.root.logger=${zookeeper_rootlogger} \
+            -Dlog4j.configuration=${zookeeper_log4jpropfile}"
+
+${JAVA} -cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS \
+    ${log4j_params} ${zookeeper_main} $@

Added: head/devel/zookeeper/files/zkServer.sh.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/zookeeper/files/zkServer.sh.in	Thu Jan  7 15:42:56 2016	(r405460)
@@ -0,0 +1,42 @@
+#!/bin/sh
+# $FreeBSD$
+
+zookeeper_log4jpropfile="file:%%ETCDIR%%/log4j.properties"
+zookeeper_rootlogger="WARN,CONSOLE"
+zookeeper_config=${2:-%%ETCDIR%%/zoo.cfg}
+
+JAVA=%%JAVA%%
+JAVAJARDIR=%%JAVAJARDIR%%
+
+zookeeper_datadir=$(grep '^dataDir' ${zookeeper_config} | sed -e 's/.*=//')
+
+zookeeper_pidfile=${zookeeper_datadir}/zookeeper.pid
+
+for i in zookeeper jline slf4j-api netty log4j
+do
+    CLASSPATH="${JAVAJARDIR}/$i.jar:$CLASSPATH"
+done
+CLASSPATH=/usr/local/share/slf4j/slf4j-log4j12.jar:$CLASSPATH
+
+zookeeper_main="org.apache.zookeeper.server.quorum.QuorumPeerMain"
+log4j_params="-Dzookeeper.log.dir=${zookeeper_datadir} \
+            -Dzookeeper.root.logger=${zookeeper_rootlogger} \
+            -Dlog4j.configuration=${zookeeper_log4jpropfile}"
+
+case $1 in
+    start)
+        mkdir -p ${zookeeper_datadir}
+        ${JAVA} -cp "$CLASSPATH" \
+            ${log4j_params} ${zookeeper_main} ${zookeeper_config} &
+        echo "STARTED"
+        echo $! > ${zookeeper_pidfile}
+        ;;
+    stop)
+        kill $(cat ${zookeeper_pidfile})
+        rm ${zookeeper_pidfile}
+        echo "STOPPED"
+        ;;
+    *)
+        echo "Usage: $0 {start|stop}" >&2
+        ;;
+esac

Modified: head/devel/zookeeper/files/zookeeper.in
==============================================================================
--- head/devel/zookeeper/files/zookeeper.in	Thu Jan  7 15:41:35 2016	(r405459)
+++ head/devel/zookeeper/files/zookeeper.in	Thu Jan  7 15:42:56 2016	(r405460)
@@ -15,31 +15,44 @@
 name=zookeeper
 rcvar=zookeeper_enable
 
-load_rc_config $name
+load_rc_config "${name}"
 
-# set defaults
-: ${zookeeper_enable:="NO"}
-: ${zookeeper_logdir="%%ZOOKEEPER_LOGDIR%%"}
-: ${zookeeper_rundir="%%ZOOKEEPER_RUNDIR%%"}
-: ${zookeeper_jmx:="YES"}
+: ${zookeeper_enable:=NO}
+: ${zookeeper_user:=%%ZOOKEEPER_USER%%}
+: ${zookeeper_group:=%%ZOOKEEPER_GROUP%%}
+: ${zookeeper_pidfile:=/var/run/zookeeper.pid}
+: ${zookeeper_config:=%%ETCDIR%%/zoo.cfg}
+: ${zookeeper_log4jpropfile:=file:%%ETCDIR%%/log4j.properties}
+: ${zookeeper_rootlogger:="INFO,ROLLINGFILE"}
+: ${zookeeper_logdir:=%%ZOOKEEPER_LOGDIR%%}
+
+JAVA=%%JAVA%%
+JAVAJARDIR=%%JAVAJARDIR%%
+
+for i in zookeeper jline slf4j-api netty log4j
+do
+    CLASSPATH="${JAVAJARDIR}/$i.jar:$CLASSPATH"
+done
+CLASSPATH=/usr/local/share/slf4j/slf4j-log4j12.jar:$CLASSPATH
+
+zookeeper_main="-cp $CLASSPATH org.apache.zookeeper.server.quorum.QuorumPeerMain ${zookeeper_config}"
+log4j_params="-Dzookeeper.log.dir=${zookeeper_logdir} \
+            -Dlog4j.configuration=${zookeeper_log4jpropfile} \
+            -Dzookeeper.root.logger=${zookeeper_rootlogger}"
+pidfile=${zookeeper_pidfile}
+procname=${JAVA}
+required_files="${zookeeper_config}"
 
-command="%%PREFIX%%/zookeeper/bin/zkServer.sh"
+command="/usr/sbin/daemon"
+command_args="-p ${pidfile} ${JAVA} ${log4j_params} ${zookeeper_main}"
 
-start_cmd="zookeeper_command start"
-stop_cmd="zookeeper_command stop"
-restart_cmd="zookeeper_command restart"
-status_cmd="zookeeper_command status"
+start_precmd="zookeeper_init"
 
-export ZOO_LOG_DIR=${zookeeper_logdir}
-export ZOOPIDFILE=${zookeeper_rundir}/zookeeper.pid
-
-zookeeper_command()
+zookeeper_init()
 {
-	export JAVA_HOME=%%JAVA_HOME%%
-	if ! checkyesno zookeeper_jmx; then
-		export JMXDISABLE=yes
-	fi
-	${command} ${rc_arg}
+    touch ${pidfile}
+    chown ${zookeeper_user}:${zookeeper_group} ${pidfile}
+    install -d -m 755 -o ${zookeeper_user} -g ${zookeeper_group} ${zookeeper_logdir}
 }
 
 run_rc_command "$1"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601071542.u07FguKu043799>