mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
Force overwrite updated dependencies on macOS
This commit is contained in:
parent
3beda962f3
commit
e3396c6572
@ -113,11 +113,17 @@ link_libraries() {
|
|||||||
sudo mkdir -p "$formula_prefix"/lib
|
sudo mkdir -p "$formula_prefix"/lib
|
||||||
for lib in "$formula_prefix"/lib/*.dylib; do
|
for lib in "$formula_prefix"/lib/*.dylib; do
|
||||||
lib_name=$(basename "$lib")
|
lib_name=$(basename "$lib")
|
||||||
sudo cp -a "$lib" "$brew_prefix/lib/old_$lib_name" 2>/dev/null || true
|
sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
|
||||||
sudo ln -sf "$brew_prefix"/lib/old_"$lib_name" "$brew_prefix/lib/$lib_name"
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Patch brew to overwrite packages
|
||||||
|
patch_brew() {
|
||||||
|
sudo sed -i '' "s/ keg.link(verbose: verbose?)/ keg.link(verbose: verbose?, overwrite: true)/" "$brew_repo"/Library/Homebrew/formula_installer.rb
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap "git -C $brew_repo stash >/dev/null 2>&1" exit
|
||||||
|
}
|
||||||
|
|
||||||
update_dependencies_helper() {
|
update_dependencies_helper() {
|
||||||
dependency=$1
|
dependency=$1
|
||||||
get -q -n "$tap_dir/homebrew/homebrew-core/Formula/$dependency.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$dependency.rb"
|
get -q -n "$tap_dir/homebrew/homebrew-core/Formula/$dependency.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$dependency.rb"
|
||||||
@ -127,6 +133,7 @@ update_dependencies_helper() {
|
|||||||
# Function to update dependencies.
|
# Function to update dependencies.
|
||||||
update_dependencies() {
|
update_dependencies() {
|
||||||
if ! [ -e /tmp/update_dependencies ] && [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
if ! [ -e /tmp/update_dependencies ] && [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
||||||
|
patch_brew
|
||||||
while read -r dependency; do
|
while read -r dependency; do
|
||||||
update_dependencies_helper "$dependency" &
|
update_dependencies_helper "$dependency" &
|
||||||
to_wait+=($!)
|
to_wait+=($!)
|
||||||
|
Loading…
Reference in New Issue
Block a user