forked from openwpm/OpenWPM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·90 lines (80 loc) · 3.1 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
set -e
if [[ $# -gt 1 ]]; then
echo "Usage: install.sh [--flash | --no-flash]" >&2
exit 1
fi
if [[ $# -gt 0 ]]; then
case "$1" in
"--flash")
flash=true
;;
"--no-flash")
flash=false
;;
*)
echo "Usage: install.sh [--flash | --no-flash]" >&2
exit 1
;;
esac
else
echo "Would you like to install Adobe Flash Player? (Only required for crawls with Flash) [y,N]"
read -s -n 1 response
if [[ $response = "" ]] || [ $response == 'n' ] || [ $response == 'N' ]; then
flash=false
echo Not installing Adobe Flash Plugin
elif [ $response == 'y' ] || [ $response == 'Y' ]; then
flash=true
echo Installing Adobe Flash Plugin
else
echo Unrecognized response, exiting
exit 1
fi
fi
if [ "$flash" = true ]; then
sudo sh -c 'echo "deb http://archive.canonical.com/ubuntu/ trusty partner" >> /etc/apt/sources.list.d/canonical_partner.list'
fi
sudo apt-get update
sudo apt-get install -y firefox htop git python-dev libxml2-dev libxslt-dev libffi-dev libssl-dev build-essential xvfb libboost-python-dev libleveldb-dev libjpeg-dev curl wget
# For some versions of ubuntu, the package libleveldb1v5 isn't available. Use libleveldb1 instead.
sudo apt-get install -y libleveldb1v5 || sudo apt-get install -y libleveldb1
if [ "$flash" = true ]; then
sudo apt-get install -y adobe-flashplugin
fi
# Check if we're running on continuous integration
# Python requirements are already installed by .travis.yml on Travis
if [ "$TRAVIS" != "true" ]; then
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
rm get-pip.py
pip install --user --upgrade -r requirements.txt
fi
# Grab the latest version of Firefox ESR.
# For security reasons it is very important to keep up with patch releases
# of the ESR, but a major version bump needs to be tested carefully.
# Older ESRs are not supported by geckodriver.
firefox_version="$(curl 'https://ftp.mozilla.org/pub/firefox/releases/' |
grep '/pub/firefox/releases/52.' |
tail -n 1 | sed -e 's/.*releases\///g' | cut -d '/' -f1)"
wget https://ftp.mozilla.org/pub/firefox/releases/${firefox_version}/linux-$(uname -m)/en-US/firefox-${firefox_version}.tar.bz2
tar jxf firefox-${firefox_version}.tar.bz2
rm -rf firefox-bin
mv firefox firefox-bin
rm firefox-${firefox_version}.tar.bz2
# Selenium 3.3+ requires a 'geckodriver' helper executable, which is not yet
# packaged. `geckodriver` 0.16.0+ is not compatible with Firefox 52. See:
# https://github.com/mozilla/geckodriver/issues/743
GECKODRIVER_VERSION=0.15.0
case $(uname -m) in
(x86_64)
GECKODRIVER_ARCH=linux64
;;
(*)
echo Platform $(uname -m) not known to be supported by geckodriver >&2
exit 1
;;
esac
wget https://github.com/mozilla/geckodriver/releases/download/v${GECKODRIVER_VERSION}/geckodriver-v${GECKODRIVER_VERSION}-${GECKODRIVER_ARCH}.tar.gz
tar zxf geckodriver-v${GECKODRIVER_VERSION}-${GECKODRIVER_ARCH}.tar.gz
rm geckodriver-v${GECKODRIVER_VERSION}-${GECKODRIVER_ARCH}.tar.gz
mv geckodriver firefox-bin