Skip to content

Instantly share code, notes, and snippets.

@aldrinmartoq
Created May 13, 2023 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aldrinmartoq/829f3882617ad935684c4ced60974c5a to your computer and use it in GitHub Desktop.
Save aldrinmartoq/829f3882617ad935684c4ced60974c5a to your computer and use it in GitHub Desktop.
#!/bin/bash
VERSION_URL="https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
VERSION=$(curl -f --silent $VERSION_URL)
if [ -z "$VERSION" ]; then
echo "Failed to read current version from $VERSION_URL. Aborting."
exit 1
else
echo "Current version is $VERSION"
fi
# Abort script if any of the next commands fails.
set -e
set -o pipefail
ZIPFILEPATH="/tmp/chromedriver-$VERSION.zip"
echo "Downloading to $ZIPFILEPATH"
curl -f --silent "https://chromedriver.storage.googleapis.com/$VERSION/chromedriver_mac64.zip" > "$ZIPFILEPATH"
BINFILEPATH="/usr/local/bin/chromedriver-$VERSION"
echo "Extracting to $BINFILEPATH"
unzip -p "$ZIPFILEPATH" chromedriver > "$BINFILEPATH"
echo Setting execute flag
chmod +x "$BINFILEPATH"
echo Updating symlink
ln -nfs "$BINFILEPATH" /usr/local/bin/chromedriver
echo Removing ZIP file
rm "$ZIPFILEPATH"
echo Done
chromedriver -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment