From 5c951bbfb316ec576a473b21d4bda2405a9dbb92 Mon Sep 17 00:00:00 2001 From: cytopia Date: Mon, 28 Jan 2019 11:35:40 +0100 Subject: [PATCH] Only configure blackfire cli if binary is present --- autostart/configure-blackfire-cli.sh-example | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/autostart/configure-blackfire-cli.sh-example b/autostart/configure-blackfire-cli.sh-example index 344b1826..9cece3e3 100755 --- a/autostart/configure-blackfire-cli.sh-example +++ b/autostart/configure-blackfire-cli.sh-example @@ -5,6 +5,15 @@ set -u set -o pipefail +### +### Pre-flight check +### +if ! command -v blackfire >/dev/null 2>&1; then + echo "No blackfire cli found, skipping configuration." + exit 0 +fi + + ### ### Blackfire Client (cli) Variables ### @@ -12,7 +21,8 @@ set -o pipefail BF_CLIENT_ID= # Blackfire Client Token via env: BLACKFIRE_SERVER_TOKEN BF_CLIENT_TOKEN= - +# Blackfire client configuration file +BF_CLIENT_INI="/home/devilbox/.blackfire.ini" ### ### Get Client ID and Client Token @@ -76,7 +86,7 @@ fi echo "; desc : Sets the Blackfire API connection timeout"; echo "; default: 15s"; echo "timeout=15s"; -} > /home/devilbox/.blackfire.ini +} > "${BF_CLIENT_INI}" -chown devilbox:devilbox /home/devilbox/.blackfire.ini -chmod 0600 /home/devilbox/.blackfire.ini +chown devilbox:devilbox "${BF_CLIENT_INI}" +chmod 0600 "${BF_CLIENT_INI}"