mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Fix add_brew_tap in darwin.sh
Fix shellcheck in darwin.sh
This commit is contained in:
parent
5098017251
commit
d891a81b7f
@ -39,17 +39,29 @@ add_pecl_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to fetch a brew tap
|
||||||
|
fetch_brew_tap() {
|
||||||
|
tap=$1
|
||||||
|
tap_user=$(dirname "$tap")
|
||||||
|
tap_name=$(basename "$tap")
|
||||||
|
mkdir -p "$tap_dir/$tap_user"
|
||||||
|
get -s -n "" "https://github.com/$tap/archive/master.tar.gz" | sudo tar -xzf - -C "$tap_dir/$tap_user"
|
||||||
|
if [ -d "$tap_dir/$tap_user/$tap_name-master" ]; then
|
||||||
|
sudo mv "$tap_dir/$tap_user/$tap_name-master" "$tap_dir/$tap_user/$tap_name"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to add a brew tap.
|
# Function to add a brew tap.
|
||||||
add_brew_tap() {
|
add_brew_tap() {
|
||||||
tap=$1
|
tap=$1
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
tap_user=$(dirname "$tap")
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
tap_name=$(basename "$tap")
|
|
||||||
get -s -n "" "https://github.com/$tap/archive/master.tar.gz" | tar -xzf - -C "$tap_dir/$tap_user" >/dev/null 2>&1
|
|
||||||
if [ -d "$tap_dir/$tap_user/$tap_name-master" ]; then
|
|
||||||
sudo mv "$tap_dir/$tap_user/$tap_name-master" "$tap_dir/$tap_user/$tap_name"
|
|
||||||
else
|
|
||||||
brew tap --shallow "$tap" >/dev/null 2>&1
|
brew tap --shallow "$tap" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
fetch_brew_tap "$tap" >/dev/null 2>&1
|
||||||
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
|
brew tap --shallow "$tap" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -62,6 +74,7 @@ add_brew_extension() {
|
|||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
add_log "${tick:?}" "$extension" "Enabled"
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
|
add_brew_tap shivammathur/homebrew-php
|
||||||
add_brew_tap shivammathur/homebrew-extensions
|
add_brew_tap shivammathur/homebrew-extensions
|
||||||
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$extension"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
|
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$extension"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
|
||||||
brew install "$extension@$version" >/dev/null 2>&1
|
brew install "$extension@$version" >/dev/null 2>&1
|
||||||
@ -144,7 +157,7 @@ setup_php() {
|
|||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
||||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
||||||
if [ ${semver%.*} != "$version" ]; then
|
if [ "${semver%.*}" != "$version" ]; then
|
||||||
add_log "$cross" "PHP" "Could not setup PHP $version"
|
add_log "$cross" "PHP" "Could not setup PHP $version"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user