diff --git a/misc/crowdsec.sh b/misc/crowdsec.sh index 835a7dd92..e59eace03 100644 --- a/misc/crowdsec.sh +++ b/misc/crowdsec.sh @@ -26,28 +26,28 @@ alias die='EXIT=$? LINE=$LINENO error_exit' trap die ERR function error_exit() { - trap - ERR - local reason="Unknown failure occured." - local msg="${1:-$reason}" - local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" - echo -e "$flag $msg" 1>&2 - exit $EXIT + trap - ERR + local reason="Unknown failure occured." + local msg="${1:-$reason}" + local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit "$EXIT" } if command -v pveversion >/dev/null 2>&1; then - echo -e "⚠️ Can't Install on Proxmox " - exit + echo -e "⚠️ Can't Install on Proxmox " + exit fi while true; do - read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn - case $yn in - [Yy]*) break ;; - [Nn]*) exit ;; - *) echo "Please answer yes or no." ;; - esac + read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac done clear -function header_info { - echo -e "${BL} +function header_info() { + echo -e "${BL} _____ _ _____ / ____| | |/ ____| | | _ __ _____ ____| | (___ ___ ___ @@ -60,20 +60,20 @@ ${CL}" header_info function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." } function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" } msg_info "Setting up ${APP} Repository" apt-get update &>/dev/null apt-get install -y curl &>/dev/null apt-get install -y gnupg &>/dev/null -curl -fsSL https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.deb.sh | bash &>/dev/null +curl -fsSL "https://install.crowdsec.net" | bash &>/dev/null msg_ok "Setup ${APP} Repository" msg_info "Installing ${APP}"