diff options
Diffstat (limited to 'app-misc/elasticsearch')
-rw-r--r-- | app-misc/elasticsearch/ChangeLog | 8 | ||||
-rw-r--r-- | app-misc/elasticsearch/elasticsearch-0.90.6-r1.ebuild | 86 | ||||
-rw-r--r-- | app-misc/elasticsearch/files/elasticsearch.init2 | 87 |
3 files changed, 180 insertions, 1 deletions
diff --git a/app-misc/elasticsearch/ChangeLog b/app-misc/elasticsearch/ChangeLog index 6dc67f1b61fa..7caf4e0d0bbb 100644 --- a/app-misc/elasticsearch/ChangeLog +++ b/app-misc/elasticsearch/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for app-misc/elasticsearch # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-misc/elasticsearch/ChangeLog,v 1.1 2013/11/07 09:19:22 chainsaw Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-misc/elasticsearch/ChangeLog,v 1.2 2013/11/27 13:44:30 chainsaw Exp $ + +*elasticsearch-0.90.6-r1 (27 Nov 2013) + + 27 Nov 2013; Tony Vroon <chainsaw@gentoo.org> + +elasticsearch-0.90.6-r1.ebuild, +files/elasticsearch.init2: + Have the init script work properly, fixes by Simon Alman. Closes bug #491324. *elasticsearch-0.90.6 (07 Nov 2013) diff --git a/app-misc/elasticsearch/elasticsearch-0.90.6-r1.ebuild b/app-misc/elasticsearch/elasticsearch-0.90.6-r1.ebuild new file mode 100644 index 000000000000..db1fac018602 --- /dev/null +++ b/app-misc/elasticsearch/elasticsearch-0.90.6-r1.ebuild @@ -0,0 +1,86 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-misc/elasticsearch/elasticsearch-0.90.6-r1.ebuild,v 1.1 2013/11/27 13:44:30 chainsaw Exp $ + +EAPI=5 + +inherit eutils systemd + +MY_PN="${PN%-bin}" +DESCRIPTION="Open Source, Distributed, RESTful, Search Engine" +HOMEPAGE="http://www.elasticsearch.org/" +SRC_URI="http://download.${MY_PN}.org/${MY_PN}/${MY_PN}/${MY_PN}-${PV}.tar.gz" +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64" + +RESTRICT="strip" +QA_PREBUILT="usr/share/elasticsearch/lib/sigar/libsigar-*.so" + +RDEPEND="virtual/jre" + +pkg_setup() { + enewgroup ${MY_PN} + enewuser ${MY_PN} -1 /bin/bash /var/lib/${MY_PN} ${MY_PN} +} + +src_prepare() { + rm -rf lib/sigar/*{solaris,winnt,freebsd,macosx}* + rm lib/sigar/libsigar-ia64-linux.so + rm LICENSE.txt + + mv bin/${MY_PN}.in.sh bin/${MY_PN}.in.sh.sample + for file in config/* ; do + mv ${file} ${file}.sample + done + + use amd64 && { + rm lib/sigar/libsigar-x86-linux.so + } + + use x86 && { + rm lib/sigar/libsigar-amd64-linux.so + } +} + +src_install() { + dodir /etc/${MY_PN} + insinto /etc/${MY_PN} + doins bin/${MY_PN}.in.sh.sample + doins config/* + rm bin/${MY_PN}.in.sh.sample + rm -rf config + + insinto /usr/share/${MY_PN} + doins -r ./* + chmod +x "${D}"/usr/share/${MY_PN}/bin/* + + keepdir /var/{lib,log}/${MY_PN} + + local rcscript=elasticsearch.init2 + local eshome="/usr/share/${MY_PN}" + local jarfile="${MY_PN}-${PV}.jar" + local esclasspath="${eshome}/lib/${jarfile}:${eshome}/lib/*:${eshome}/lib/sigar/*" + + cp "${FILESDIR}/${rcscript}" "${T}" || die + sed -i \ + -e "s|@ES_CLASS_PATH@|${esclasspath}|" \ + "${T}/${rcscript}" \ + || die "failed to filter ${rcscript}" + + newinitd "${T}/${rcscript}" "${MY_PN}" + newconfd "${FILESDIR}/${MY_PN}.conf" "${MY_PN}" + systemd_dounit "${FILESDIR}"/${PN}.service +} + +pkg_postinst() { + elog + elog "You may create multiple instances of ${MY_PN} by" + elog "symlinking the init script ln -sf /etc/init.d/${MY_PN} /etc/init.d/${MY_PN}.instance" + elog + elog "Each of the *.sample files in /etc/${MY_PN} should be copied" + elog "to the proper configuration directory:" + elog "/etc/${MY_PN} (for standard init)" + elog "/etc/${MY_PN}/instance (for symlinked init)" + elog +} diff --git a/app-misc/elasticsearch/files/elasticsearch.init2 b/app-misc/elasticsearch/files/elasticsearch.init2 new file mode 100644 index 000000000000..5fbb2e97285d --- /dev/null +++ b/app-misc/elasticsearch/files/elasticsearch.init2 @@ -0,0 +1,87 @@ +#!/sbin/runscript + +name="ElasticSearch" +description="" + +ES_USER=${ES_USER:="elasticsearch"} +ES_INSTANCE=${SVCNAME#*.} +export ES_CLASSPATH="@ES_CLASS_PATH@" + +if [ -n "${ES_INSTANCE}" ] && [ ${SVCNAME} != "elasticsearch" ]; then + PIDFILE="/run/elasticsearch/elasticsearch.${ES_INSTANCE}.pid" + ES_BASE_PATH="/var/lib/elasticsearch/${ES_INSTANCE}" + ES_CONF_PATH="/etc/elasticsearch/${ES_INSTANCE}" + ES_LOG_PATH="/var/log/elasticsearch/${ES_INSTANCE}" +else + PIDFILE="/run/elasticsearch/elasticsearch.pid" + ES_BASE_PATH="/var/lib/elasticsearch/_default" + ES_CONF_PATH="/etc/elasticsearch" + ES_LOG_PATH="/var/log/elasticsearch/_default" +fi + +ES_DATA_PATH="${ES_BASE_PATH}/data" +ES_WORK_PATH="${ES_BASE_PATH}/work" + +export ES_INCLUDE="${ES_CONF_PATH}/elasticsearch.in.sh" +export JAVA_OPTS +export ES_JAVA_OPTS +export ES_HEAP_SIZE +export ES_HEAP_NEWSIZE +export ES_DIRECT_SIZE +export ES_USE_IPV4 + +server_command="/usr/share/elasticsearch/bin/elasticsearch" +server_args=" -p ${PIDFILE} -f -Des.path.conf=\"${ES_CONF_PATH}\" -Des.path.data=\"${ES_DATA_PATH}\" -Des.path.work=\"${ES_WORK_PATH}\" -Des.path.logs=\"${ES_LOG_PATH}\"" + +depend() { + use net +} + +start() { + # elasticsearch -f -Des.config=/path/to/config/file + # elasticsearch -f -Des.network.host=10.0.0.4 + + [ ! -f "${ES_INCLUDE}" ] && { + eerror "${ES_INCLUDE} must be copied into place" + return 1 + } + + local conf + local conf_file + for conf in elasticsearch.yml logging.yml; do + conf_file="${ES_CONF_PATH}/${conf}" + if [ ! -f "${conf_file}" ]; then + eerror "${conf_file} must be copied into place" + return 1 + fi + done + + ebegin "Starting ${SVCNAME}" + + if [ -n "${ES_MAX_FD}" ]; then + ulimit -n ${ES_MAX_FD} + einfo "Max open filedescriptors : ${ES_MAX_FD}" + fi + + + checkpath -d -o "${ES_USER}" -m750 "/var/lib/elasticsearch" + checkpath -d -o "${ES_USER}" -m750 "/var/log/elasticsearch" + checkpath -d -o "${ES_USER}" -m750 "$(dirname "${PIDFILE}")" + checkpath -d -o "${ES_USER}" -m750 "${ES_BASE_PATH}" + checkpath -d -o "${ES_USER}" -m750 "${ES_LOG_PATH}" + + start-stop-daemon --start \ + --background \ + --chdir "${ES_BASE_PATH}" \ + --user="${ES_USER}" \ + --pidfile="${PIDFILE}" \ + --exec ${server_command} -- ${server_args} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop \ + --pidfile=${PIDFILE} + eend $? +} |