Skip to content

Commit

Permalink
Create install_chrome.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
csidyel authored Dec 2, 2024
1 parent 801c2af commit d8c7bac
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions install_chrome.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Usage: ./.semaphore/helpers/install_chrome.sh
# Installs Chrome and Chromedriver to /usr/local/bin/chrome and /usr/local/bin/chromedriver
# This script assumes you've already run download_chrome.sh or restored vendor/chrome from Semaphore cache
# If it cannot find the 'vendor/chrome' directory, it will re-download Chrome and Chromedriver.

set -euo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/

if [ ! -d "vendor/chrome" ]; then
echo "'vendor/chrome' not found, downloading Chrome and Chromedriver..."
./.semaphore/helpers/download_chrome.sh
fi

sudo cp -r vendor/chrome/chrome-linux64 /usr/local/bin/chrome-linux64
sudo ln -sf /usr/local/bin/chrome-linux64/chrome /usr/local/bin/chrome
sudo ln -sf /usr/local/bin/chrome-linux64/chrome /usr/bin/google-chrome
sudo cp -r vendor/chrome/chromedriver-linux64 /usr/local/bin/chromedriver-linux64
sudo ln -sf /usr/local/bin/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver

CHROME_VERSION=$(chrome --version)
CHROMEDRIVER_VERSION=$(chromedriver --version)

echo "Installed chrome ($CHROME_VERSION) and chromedriver ($CHROMEDRIVER_VERSION)."

0 comments on commit d8c7bac

Please sign in to comment.