# Template file for 'zookeeper'
pkgname=zookeeper
version=3.4.13
revision=2
depends="virtual?java-runtime"
short_desc="Distributed hierarchical key-value store"
maintainer="Mickael Fortunato <morsi.morsicus@gmail.com>"
license="Apache-2.0, MIT, BSD-3-Clause"
homepage="http://zookeeper.apache.org/"
distfiles="https://archive.apache.org/dist/zookeeper/zookeeper-${version}/zookeeper-${version}.tar.gz"
checksum=7ced798e41d2027784b8fd55c908605ad5bd94a742d5dab2506be8f94770594d
system_accounts="_zookeeper"

do_install() {
	# License
	cp lib/jline-*.LICENSE.txt jline.LICENSE
	vlicense jline.LICENSE
	cp lib/slf4j-*.LICENSE.txt slf4j.LICENSE
	vlicense slf4j.LICENSE

	# Documentation
	vmkdir usr/share/doc/${pkgname}
	vcopy "docs/*" usr/share/doc/${pkgname}

	# Configuration example
	vmkdir usr/share/examples/${pkgname}
	vcopy conf usr/share/examples/${pkgname}

	# Default configuration
	vmkdir etc/${pkgname}/conf
	vcopy conf/zoo_sample.cfg etc/${pkgname}/conf/environment

	# Main class
	vmkdir usr/share/${pkgname}
	vcopy ${pkgname}-${version}.jar usr/share/${pkgname}

	# Tools
	vmkdir usr/share/${pkgname}/bin
	vcopy "bin/*.sh" usr/share/${pkgname}/bin

	# Classpath
	vmkdir usr/share/${pkgname}/lib
	vcopy "lib/*.jar" usr/share/${pkgname}/lib

	# Service
	vsv ${pkgname}
}
