mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
parent
fec0be423a
commit
b27646e03d
1 changed files with 1 additions and 54 deletions
55
bin/plugin
55
bin/plugin
|
@ -3,59 +3,6 @@
|
|||
#
|
||||
# Usage:
|
||||
# bin/plugin install contrib
|
||||
#
|
||||
# Figure out if we're using wget or curl
|
||||
|
||||
basedir=$(cd `dirname $0`/..; pwd)
|
||||
. ${basedir}/bin/logstash.lib.sh
|
||||
|
||||
WGET=$(which wget 2>/dev/null)
|
||||
CURL=$(which curl 2>/dev/null)
|
||||
|
||||
URLSTUB="http://download.elasticsearch.org/logstash/logstash/"
|
||||
|
||||
if [ "x$WGET" != "x" ]; then
|
||||
DOWNLOAD_COMMAND="wget -q --no-check-certificate -O"
|
||||
elif [ "x$CURL" != "x" ]; then
|
||||
DOWNLOAD_COMMAND="curl -s -L -k -o"
|
||||
else
|
||||
echo "wget or curl are required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "$basedir/lib/logstash/version.rb" ] ; then
|
||||
VERSION=$(cat "$basedir/lib/logstash/version.rb" | grep LOGSTASH_VERSION | awk -F\" '{print $2}')
|
||||
else
|
||||
echo "ERROR: Cannot determine Logstash version. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Placeholder for now, if other installs ever become available.
|
||||
if [ "x$2" != "xcontrib" ]; then
|
||||
echo "Can only install contrib at this time... Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGETDIR="$basedir/vendor/logstash"
|
||||
mkdir -p $TARGETDIR
|
||||
SUFFIX=".tar.gz"
|
||||
FILEPATH="logstash-contrib-${VERSION}"
|
||||
FILENAME=${FILEPATH}${SUFFIX}
|
||||
TARGET="${TARGETDIR}/${FILENAME}"
|
||||
|
||||
case $1 in
|
||||
install)
|
||||
$DOWNLOAD_COMMAND ${TARGET} ${URLSTUB}${FILENAME}
|
||||
if [ ! -f "${TARGET}" ]; then
|
||||
echo "ERROR: Unable to download ${URLSTUB}${FILENAME}"
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
fi
|
||||
gzip -dc ${TARGET} | tar -xC $TARGETDIR
|
||||
cp -R ${TARGETDIR}/$FILEPATH/* $basedir ;; # Copy contents to local directory, adding on top of existing install
|
||||
*)
|
||||
echo "Usage: bin/plugin install contrib"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
. ${basedir}/bin/logstash plugin "$@"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue