Uprade existing macOS version

This commit is contained in:
Shivam Mathur 2024-03-25 07:30:22 +05:30
parent f4fb0af4d5
commit 73963f5001
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -140,17 +140,6 @@ update_dependencies() {
fi fi
} }
# Function to fix dependencies on install PHP version.
fix_dependencies() {
broken_deps_paths=$(php -v 2>&1 | grep -Eo '/opt/[a-zA-Z0-9@\.]+')
if [ "x$broken_deps_paths" != "x" ]; then
update_dependencies
IFS=" " read -r -a formulae <<< "$(echo "$broken_deps_paths" | tr '\n' ' ' | sed 's|/opt/||g' 2>&1)$php_formula"
brew reinstall "${formulae[@]}"
brew link --force --overwrite "$php_formula" || true
fi
}
# Function to get PHP version if it is already installed using Homebrew. # Function to get PHP version if it is already installed using Homebrew.
get_brewed_php() { get_brewed_php() {
cellar="$brew_prefix"/Cellar cellar="$brew_prefix"/Cellar
@ -232,8 +221,8 @@ setup_php() {
add_php "upgrade" "$existing_version" >/dev/null 2>&1 add_php "upgrade" "$existing_version" >/dev/null 2>&1
status="Updated to" status="Updated to"
else else
status="Found" add_php "upgrade" "$existing_version" >/dev/null 2>&1
fix_dependencies >/dev/null 2>&1 status="Updated to"
fi fi
php_config="$(command -v php-config)" php_config="$(command -v php-config)"
ext_dir="$(grep 'extension_dir=' "$php_config" | cut -d "'" -f 2)" ext_dir="$(grep 'extension_dir=' "$php_config" | cut -d "'" -f 2)"