forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-dev-dependencies.sh
executable file
·105 lines (99 loc) · 3.9 KB
/
install-dev-dependencies.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# Install packages that are necessary and/or useful to build and debug
# HTTPS Everywhere
set -o errexit
if [ "$1" != "--no-prompt" ]; then
echo
echo "Warning: Installing the development dependencies for HTTPS Everywhere"
echo "may alter your system, installing requirements both within the package"
echo "management system and also external binaries."
echo
echo -n "Are you sure you want to continue? [Y/n]: "
read CONTINUE
CONTINUE=`echo $CONTINUE | xargs | head -c 1 | awk '{print tolower($0)}'`
if [ "$CONTINUE" != "y" ]; then
exit
fi
echo
fi
if [ $UID != 0 ]; then
SUDO_SHIM=sudo
fi
if type apt-get >/dev/null ; then
$SUDO_SHIM apt-get update
$SUDO_SHIM apt-get install -y lsb-release
BROWSERS="firefox chromium-browser"
CHROMEDRIVER="chromium-chromedriver"
if [[ "$(lsb_release -is)" == "Debian" ]]; then
# Iceweasel is the rebranded Firefox that Debian ships, and Chromium
# takes the name of 'chromium' instead of 'chromium-browser' in
# Debian 7 (wheezy) and later.
BROWSERS="iceweasel chromium"
CHROMEDRIVER="chromedriver"
fi
# In Debian, `python-` is assumed to be python 2.7, no need to specify - dkg
$SUDO_SHIM apt-get install -y libxml2-dev libxml2-utils libxslt1-dev \
python-dev $BROWSERS zip sqlite3 python-pip libcurl4-openssl-dev xvfb \
libssl-dev git curl $CHROMEDRIVER
if ! type geckodriver >/dev/null; then
curl -LO "https://github.com/mozilla/geckodriver/releases/download/v0.17.0/geckodriver-v0.17.0-linux64.tar.gz"
tar -zxvf "geckodriver-v0.17.0-linux64.tar.gz"
rm -f "geckodriver-v0.17.0-linux64.tar.gz"
$SUDO_SHIM mv geckodriver /usr/bin/geckodriver
$SUDO_SHIM chown root /usr/bin/geckodriver
$SUDO_SHIM chmod 755 /usr/bin/geckodriver
fi
if [ ! -f /usr/lib/chromium/chromedriver ] && [ -f `which chromedriver` ]; then
ln -s `which chromedriver` /usr/lib/chromium/chromedriver
fi
elif type brew >/dev/null ; then
brew list python &>/dev/null || brew install python
brew install libxml2 gnu-sed chromedriver
if ! echo $PATH | grep -ql /usr/local/bin ; then
echo '/usr/local/bin not found in $PATH, please add it.'
fi
elif type dnf >/dev/null ; then
$SUDO_SHIM dnf install -y firefox gcc git libcurl-devel libxml2-devel \
libxslt-devel python-devel redhat-rpm-config xorg-x11-server-Xvfb which \
findutils procps openssl openssl-devel chromium GConf2 rsync
if ! type chromedriver >/dev/null; then
if [ "`uname -m`" == "x86_64" ]; then
ARCH=64
else
ARCH=32
fi
curl -O "https://chromedriver.storage.googleapis.com/2.23/chromedriver_linux$ARCH.zip"
unzip "chromedriver_linux$ARCH.zip"
rm -f "chromedriver_linux$ARCH.zip"
$SUDO_SHIM mv chromedriver /usr/bin/chromedriver
$SUDO_SHIM chown root /usr/bin/chromedriver
$SUDO_SHIM chmod 755 /usr/bin/chromedriver
fi
if ! type geckodriver >/dev/null; then
curl -LO "https://github.com/mozilla/geckodriver/releases/download/v0.17.0/geckodriver-v0.17.0-macos.tar.gz"
tar -zxvf "geckodriver-v0.17.0-macos.tar.gz"
rm -f "geckodriver-v0.17.0-macos.tar.gz"
$SUDO_SHIM mv geckodriver /usr/bin/geckodriver
$SUDO_SHIM chown root /usr/bin/geckodriver
$SUDO_SHIM chmod 755 /usr/bin/geckodriver
fi
# This is needed for Firefox on some systems. See here for more information:
# https://github.com/EFForg/https-everywhere/pull/5584#issuecomment-238655443
if [ ! -f /var/lib/dbus/machine-id ]; then
$SUDO_SHIM sh -c 'dbus-uuidgen > /var/lib/dbus/machine-id'
fi
export PYCURL_SSL_LIBRARY=openssl
fi
# Get the addon SDK submodule and rule checker
git submodule init
git submodule update
# Install Python packages
pip install --user --no-allow-insecure --no-allow-external -r requirements.txt
cd test/rules
pip install --user -r requirements.txt
cd -
cd test/chromium
pip install --user -r requirements.txt
cd -
# Install git hook to run tests before pushing.
ln -sf ../../test.sh .git/hooks/pre-push