-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_chrome.sh
23 lines (18 loc) · 1.13 KB
/
install_chrome.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)."