Merge pull request #1861 from nikita-bykov/rework-chrome-installation

Rework Chrome MacOS installation to fix issues related to SHA
This commit is contained in:
Maxim Lobanov
2020-10-28 10:26:37 +03:00
committed by GitHub
2 changed files with 15 additions and 1 deletions

View File

@@ -1,7 +1,8 @@
#!/bin/bash -e -o pipefail
source ~/utils/utils.sh
echo "Installing Chrome..."
brew cask install google-chrome
brew_cask_install_ignoring_sha256 "google-chrome"
echo "Installing Chrome Driver"
brew cask install chromedriver

View File

@@ -107,4 +107,17 @@ get_default_xcode_from_toolset() {
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
}