When I run /usr/local/lib/elasticsearch/bin/elasticsearch-plugin I get the message: /usr/local/lib/elasticsearch/bin/elasticsearch-env: line 78: cd: /usr/local/lib/elasticsearch/config: No such file or directory This can be fixed by adding the symbolic link /usr/local/lib/elasticsearch/config pointing to /usr/local/etc/elasticsearch but there should be a better fix. Another problem occurs when you execute elasticsearch-plugin from a different path, it will execute /usr/local/bin/elasticsearch-plugin and that gives the error: /usr/local/bin/elasticsearch-plugin: line 3: /usr/local/bin/elasticsearch-env: No such file or directory /usr/local/bin/elasticsearch-plugin: line 6: exec: : not found
Much like what we previously saw with the elasticsearch rc script, this is a result of ES_PATH_CONF not being set prior to the execution of elasticsearch-plugin. Not sure if this is the best approach, but it's an idea that doesn't require modifying the stock elasticsearch-plugin script. Instead of creating the symlink to /usr/local/bin, install a wrapper script that honors the rc.conf variables and sets ES_PATH_CONF before handing execution off to the real elasticsearch-plugin.
Created attachment 191161 [details] elasticsearch-plugin wrapper simple wrapper that reads rc.conf variables and properly sets ES_PATH_CONF before handing control over to the stock elasticsearch-plugin script.
A commit references this bug: Author: feld Date: Wed Mar 14 19:17:59 UTC 2018 New revision: 464526 URL: https://svnweb.freebsd.org/changeset/ports/464526 Log: textproc/elasticsearch6: Fix ability to install plugins - Update pkg-message to provide very useful info - Use login_class=root by default to help users avoid this issue (affects everyone) PR: 226301 Changes: head/textproc/elasticsearch6/Makefile head/textproc/elasticsearch6/files/elasticsearch.in head/textproc/elasticsearch6/files/pkg-message.in
This should be fixed now. It's not as flexible as we would like, but it seems that even upstream doesn't allow this to be flexible on Linux either.