Fix brew link step

We add --overwrite parameter to brew install and upgrade commands, so that in the linking step it does not fail if another php version is linked
This commit is contained in:
Shivam Mathur 2024-06-02 23:04:56 +05:30
parent fdb0d9d1a7
commit fc14643b0a
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -164,9 +164,9 @@ add_php() {
suffix="$(get_php_formula_suffix)"
php_formula="shivammathur/php/php@$version$suffix"
if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
([ "$action" = "upgrade" ] && brew upgrade -f --overwrite "$php_formula") || brew unlink "$php_formula"
else
brew install -f "$php_formula"
brew install -f --overwrite "$php_formula"
fi
sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix"
brew link --force --overwrite "$php_formula"