Skip to content

Instantly share code, notes, and snippets.

@joshbrand
Created October 10, 2013 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshbrand/6922456 to your computer and use it in GitHub Desktop.
Save joshbrand/6922456 to your computer and use it in GitHub Desktop.
sigh
#!/bin/bash
CHANGED=0
OUT=""
RETCODE=0
if [[ -e /usr/bin/pip || -e /usr/local/bin/pip ]]
then
if [ -e $(which uwsgi) ]
then
if [ "$(uwsgi --plugin-list 2>&1 | grep graylog2)" != "graylog2" ]
then
UWSGI_EMBED_PLUGINS="graylog2" pip install uwsgi
if [ $? == 0 ]
then
CHANGED=1
OUT="uwsgi installed, plugin added."
else
OUT="failed to install uwsgi!"
RECODE=1
fi
else
OUT="uwsgi installed, plugin installed"
fi
else
UWSGI_EMBED_PLUGINS="graylog2" pip install uwsgi
if [ $? == 0 ]
then
CHANGED=1
OUT="uwsgi missing, installed with plugin."
else
OUT="failed to install uwsgi!"
RECODE=1
fi
fi
else
OUT="pip missing!"
fi
echo ""
if [ $CHANGED == 1 ]
then
echo "changed=yes comment='${OUT}'"
exit 0
else
echo "changed=no comment='${OUT}'"
exit $RETCODE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment