Skip to content

Commit 1712190

Browse files
committed
Add a Geckodriver install script for local dev
1 parent 63d30ed commit 1712190

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

scripts/geckodriver.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
# Install the latest version of geckodriver
4+
version=$(curl -sI https://github.com/mozilla/geckodriver/releases/latest | grep -i "^Location: " | sed 's/.*\///' | tr -d '\r')
5+
6+
# check that we got something
7+
if [ -z "$version" ]; then
8+
echo "Failed to determine the latest geckodriver version!"
9+
exit 1
10+
fi
11+
12+
# Geckodriver distribution is MacOS or Linux specific
13+
os="$(uname -s)"
14+
if [[ $os == "Darwin" ]]; then
15+
os_dist="macos.tar.gz"
16+
else
17+
os_dist="linux64.tar.gz"
18+
fi
19+
20+
echo "Setting up geckodriver version $version ..."
21+
url="https://github.com/mozilla/geckodriver/releases/download/${version}/geckodriver-${version}-${os_dist}"
22+
wget -q -O /tmp/geckodriver.tar.gz "$url"
23+
sudo tar -xvf /tmp/geckodriver.tar.gz -C /usr/local/bin/
24+
sudo chmod a+x /usr/local/bin/geckodriver
25+
26+
# check that geckodriver is now present
27+
type geckodriver >/dev/null 2>&1 || {
28+
echo "Failed to install geckodriver!"
29+
exit 1
30+
}

0 commit comments

Comments
 (0)