From b98785006cf0c2c2e047e706d8e1ed0c2af911a8 Mon Sep 17 00:00:00 2001 From: Brian Munro Date: Thu, 17 Mar 2022 06:04:51 +0200 Subject: [PATCH] Add extra check for environment variable Fix rm command for folders. --- scripts/install-crowdsec_openresty_bouncer | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/install-crowdsec_openresty_bouncer b/scripts/install-crowdsec_openresty_bouncer index 68a6dc0..2448f58 100755 --- a/scripts/install-crowdsec_openresty_bouncer +++ b/scripts/install-crowdsec_openresty_bouncer @@ -4,9 +4,15 @@ BLUE='\E[1;34m' CYAN='\E[1;36m' YELLOW='\E[1;33m' GREEN='\E[1;32m' +RED='\E[1;31m' RESET='\E[0m' -echo -e "${BLUE}❯ ${CYAN}Installing Crowdsec OpenResty Bouncer ${YELLOW}${CROWDSEC_OPENRESTY_BOUNCER_VERSION}...${RESET}" +echo -e "${BLUE}❯ ${CYAN}Installing Crowdsec OpenResty Bouncer ${YELLOW}${CROWDSEC_OPENRESTY_BOUNCER_VERSION:-}...${RESET}" + +if [ "${CROWDSEC_OPENRESTY_BOUNCER_VERSION:-}" = "" ]; then + echo -e "${RED}❯ ERROR: CROWDSEC_OPENRESTY_BOUNCER_VERSION environment variable is not set!${RESET}" + exit 1 +fi cd /tmp wget "https://github.com/crowdsecurity/cs-openresty-bouncer/releases/download/v${CROWDSEC_OPENRESTY_BOUNCER_VERSION}/crowdsec-openresty-bouncer.tgz" @@ -17,6 +23,6 @@ cd /tmp/crowdsec bash ./install.sh --NGINX_CONF_DIR=/etc/nginx/conf.d --LIB_PATH=/etc/nginx/lualib --CONFIG_PATH=/defaults/crowdsec --DATA_PATH=/defaults/crowdsec --docker sed -i 's|ENABLED=.*|ENABLED=false|' /defaults/crowdsec/crowdsec-openresty-bouncer.conf -rm /tmp/crowdsec +rm -rf /tmp/crowdsec echo -e "${BLUE}❯ ${GREEN}OpenResty plugins install completed${RESET}"