forked from elastic/logstash
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added plugin (only for contrib right now) installation script
Updated docs.
- Loading branch information
Showing
2 changed files
with
72 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/sh | ||
# Install contrib plugins. | ||
# | ||
# 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) | ||
exec $DOWNLOAD_COMMAND ${TARGET} ${URLSTUB}${FILENAME} | ||
if [ ! -f "${TARGET}" ]; then | ||
echo "ERROR: Unable to download ${URLSTUB}${FILENAME}" | ||
echo "Exiting." | ||
exit 1 | ||
fi | ||
gzip -dc ${TARGETDIR}${FILENAME} | tar -xC $TARGETDIR | ||
cp -R ${TARGETDIR}/$FILEPATH/* . ;; # Copy contents to local directory, adding on top of existing install | ||
*) | ||
echo "Usage: bin/plugin install contrib" | ||
exit 0 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters