#!/usr/bin/env ruby require 'pathname' # Not using optparse or trollop because they raise on unknown args, and # we want to pass all unknown args to elasticsearch. args = ARGV.join(" ") if args =~ /(-c [\w\/]+)/ conf = Pathname.new(args.slice!($1).sub("-c ",'')) conf = Pathname.new(File.expand_path(conf, Dir.pwd)) if conf.relative? ENV['ES_JAVA_OPTS'] = "-Des.path.conf=#{conf}" if es_include = conf.entries.detect { |p| p.to_s == "elasticsearch.in.sh" } ENV['ES_INCLUDE'] = es_include.expand_path conf end end exec File.expand_path("../vendor/elasticsearch/bin/elasticsearch", File.dirname(__FILE__)), args.strip