mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
Merge branch 'main' of https://github.com/actions/virtual-environments into v-malob/xcode
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash -e -o pipefail
|
||||
|
||||
download_with_retries() {
|
||||
# Due to restrictions of bash functions, positional arguments are used here.
|
||||
# In case if you using latest argument NAME, you should also set value to all previous parameters.
|
||||
@@ -5,22 +7,31 @@ download_with_retries() {
|
||||
local URL="$1"
|
||||
local DEST="${2:-.}"
|
||||
local NAME="${3:-${URL##*/}}"
|
||||
local COMPRESSED="$4"
|
||||
|
||||
echo "Downloading $URL..."
|
||||
wget $URL --output-document="$DEST/$NAME" \
|
||||
--tries=30 \
|
||||
--wait 30 \
|
||||
--retry-connrefused \
|
||||
--retry-on-host-error \
|
||||
--retry-on-http-error=404,429,500,502,503 \
|
||||
--no-verbose
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
echo "Could not download $URL; Exiting build!"
|
||||
exit 1
|
||||
if [[ $COMPRESSED == "compressed" ]]; then
|
||||
COMMAND="curl $URL -4 -sL --compressed -o '$DEST/$NAME'"
|
||||
else
|
||||
COMMAND="curl $URL -4 -sL -o '$DEST/$NAME'"
|
||||
fi
|
||||
|
||||
return 0
|
||||
echo "Downloading $URL..."
|
||||
retries=20
|
||||
interval=30
|
||||
while [ $retries -gt 0 ]; do
|
||||
((retries--))
|
||||
eval $COMMAND
|
||||
if [ $? != 0 ]; then
|
||||
echo "Unable to download $URL, next attempt in $interval sec, $retries attempts left"
|
||||
sleep $interval
|
||||
else
|
||||
echo "$URL was downloaded successfully to $DEST/$NAME"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Could not download $URL"
|
||||
return 1
|
||||
}
|
||||
|
||||
is_BigSur() {
|
||||
@@ -84,4 +95,17 @@ get_toolset_value() {
|
||||
verlte() {
|
||||
sortedVersion=$(echo -e "$1\n$2" | sort -V | head -n1)
|
||||
[ "$1" = "$sortedVersion" ]
|
||||
}
|
||||
|
||||
brew_cask_install_ignoring_sha256() {
|
||||
local TOOL_NAME=$1
|
||||
|
||||
CASK_DIR="$(brew --repo homebrew/cask)/Casks"
|
||||
chmod a+w "$CASK_DIR/$TOOL_NAME.rb"
|
||||
SHA=$(grep "sha256" "$CASK_DIR/$TOOL_NAME.rb" | awk '{print $2}')
|
||||
sed -i '' "s/$SHA/:no_check/" "$CASK_DIR/$TOOL_NAME.rb"
|
||||
brew cask install $TOOL_NAME
|
||||
pushd $CASK_DIR
|
||||
git checkout HEAD -- "$TOOL_NAME.rb"
|
||||
popd
|
||||
}
|
||||
Reference in New Issue
Block a user