From 006301e81dca8da78c6e1bb72fbb94b55082ba2d Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Thu, 23 Apr 2020 16:25:29 +0530 Subject: [PATCH] Fetch formulae before setup --- src/scripts/darwin.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 09145ece..42ce7db2 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -165,13 +165,26 @@ add_pecl() { add_log "$tick" "PECL" "Added" } +# Function to fetch updated formulas +update_formulae() { + brew_dir=$(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula + for formula in httpd pkg-config apr apr-util argon2 aspell autoconf bison curl-openssl freetds freetype gettext glib gmp icu4c jpeg krb5 libffi libpng libpq libsodium libzip oniguruma openldap openssl@1.1 re2c sqlite tidyp unixodbc webp; do + sudo curl -o "$brew_dir"/"$formula".rb -sSL https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/"$formula".rb & + to_wait+=( $! ) + done + wait "${to_wait[@]}" +} + # Function to setup PHP >=5.6 setup_php() { action=$1 - export HOMEBREW_NO_INSTALL_CLEANUP=TRUE >/dev/null 2>&1 - brew tap shivammathur/homebrew-php >/dev/null 2>&1 - brew "$action" shivammathur/php/php@"$version" >/dev/null 2>&1 - brew link --force --overwrite php@"$version" >/dev/null 2>&1 + if [ "$version" = "8.0" ]; then + update_formulae + fi + export HOMEBREW_NO_INSTALL_CLEANUP=TRUE + brew tap shivammathur/homebrew-php + brew "$action" shivammathur/php/php@"$version" + brew link --force --overwrite php@"$version" } # Variables @@ -190,10 +203,10 @@ if [[ "$version" =~ $old_versions ]]; then curl -sSL https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh | bash -s "$nodot_version" >/dev/null 2>&1 && status="Installed" elif [ "$existing_version" != "$version" ]; then - setup_php "install" + setup_php "install" >/dev/null 2>&1 status="Installed" elif [ "$existing_version" = "$version" ] && [ "$update" = "true" ]; then - setup_php "upgrade" + setup_php "upgrade" >/dev/null 2>&1 status="Updated to" else status="Found"