Improve cURL use

This commit is contained in:
Shivam Mathur
2020-08-02 19:09:29 +05:30
parent 90b6355bf0
commit 8b218279a3
6 changed files with 59 additions and 71 deletions
+2 -1
View File
@@ -4,8 +4,9 @@ extension_version=$(echo "$extension" | cut -d '-' -f 2)
if [ "$extension_version" = "blackfire" ]; then
extension_version=$(curl -sSL https://blackfire.io/docs/up-and-running/update | grep 'class="version"' | sed -e "s/ //g" | sed -n '3,3p' | cut -d '>' -f 2 | cut -d '<' -f 1)
fi
curl_opts=(-sSL --retry 5 --retry-delay 1)
ext_dir=$(php -i | grep -Ei "extension_dir => /usr" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ini_file="$scan_dir/50-blackfire.ini"
sudo curl -o $ext_dir/blackfire.so -SL https://packages.blackfire.io/binaries/blackfire-php/$extension_version/blackfire-php-darwin_amd64-php-$version.so
sudo curl -o $ext_dir/blackfire.so "${curl_opts[@]}" "https://packages.blackfire.io/binaries/blackfire-php/$extension_version/blackfire-php-darwin_amd64-php-$version.so"
echo "extension=blackfire.so" | sudo tee -a "$ini_file"