summaryrefslogtreecommitdiffstats
path: root/scripts/chromedriver.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:47:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:47:39 +0000
commit8d13bdc6cac0e20c43c6f909fc0208774b9c5c84 (patch)
tree5fd46925c6b4a881c9208772ed8e5cc0588bc164 /scripts/chromedriver.sh
parentInitial commit. (diff)
downloadprivacybadger-8d13bdc6cac0e20c43c6f909fc0208774b9c5c84.tar.xz
privacybadger-8d13bdc6cac0e20c43c6f909fc0208774b9c5c84.zip
Adding upstream version 2020.10.7.upstream/2020.10.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/chromedriver.sh')
-rwxr-xr-xscripts/chromedriver.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/chromedriver.sh b/scripts/chromedriver.sh
new file mode 100755
index 0000000..3bd55d6
--- /dev/null
+++ b/scripts/chromedriver.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+# stop on errors (nonzero exit codes), uninitialized vars
+set -eu
+
+TEMPFILE=$(mktemp)
+CHROME="$1"
+
+trap 'rm $TEMPFILE' EXIT
+
+# install the appropriate version of ChromeDriver
+chrome_version=$("$CHROME" --product-version | cut -d . -f 1-3)
+chromedriver_version_url=https://chromedriver.storage.googleapis.com/LATEST_RELEASE_"$chrome_version"
+chromedriver_version=$(wget "$chromedriver_version_url" -q -O -)
+echo "Setting up ChromeDriver version $chromedriver_version ..."
+chromedriver_url=https://chromedriver.storage.googleapis.com/"$chromedriver_version"/chromedriver_linux64.zip
+wget -q -O "$TEMPFILE" "$chromedriver_url"
+sudo unzip -q -o "$TEMPFILE" chromedriver -d /usr/local/bin/
+sudo chmod a+x /usr/local/bin/chromedriver
+
+# check that chromedriver is now present
+type chromedriver >/dev/null 2>&1 || {
+ echo "Failed to install ChromeDriver!"
+ exit 1
+}