npmauto: bump urijs from 1.19.6 to 1.19.7 in /chromium (#20107)
[https-everywhere.git] / install-dev-dependencies.sh
blob9259d02b86768b0f18c461154df45acad223a1fe
1 #!/bin/bash
2 # Install packages that are necessary and/or useful to build and debug
3 # HTTPS Everywhere
4 set -o errexit
6 if [ "$1" != "--no-prompt" ]; then
7 echo
8 echo "Warning: Installing the development dependencies for HTTPS Everywhere"
9 echo "may alter your system, installing requirements both within the package"
10 echo "management system and also external binaries."
11 echo
12 echo -n "Are you sure you want to continue? [y/N]: "
13 read CONTINUE
14 CONTINUE=`echo $CONTINUE | xargs | head -c 1 | awk '{print tolower($0)}'`
15 if [ "$CONTINUE" != "y" ]; then
16 exit
18 echo
21 if [ $UID != 0 ]; then
22 SUDO_SHIM=sudo
25 if [ "`uname -m`" == "x86_64" ]; then
26 ARCH=64
27 else
28 ARCH=32
31 # debian based installation
32 if type apt-get>/dev/null 2>&1; then
33 $SUDO_SHIM apt-get update
34 $SUDO_SHIM apt-get install -y lsb-release
35 BROWSERS="firefox chromium-browser"
36 CHROMEDRIVER="chromium-chromedriver"
37 if [[ "$(lsb_release -is)" == "Debian" ]]; then
38 # Chromium takes the name of 'chromium' instead of 'chromium-browser' in
39 # Debian 7 (wheezy) and later.
40 BROWSERS="firefox-esr chromium"
41 CHROMEDRIVER="chromium-driver"
43 $SUDO_SHIM apt-get install -y libxml2-dev libxml2-utils libxslt1-dev \
44 python3-dev $BROWSERS zip sqlite3 python3-pip libcurl4-openssl-dev xvfb \
45 nodejs \
46 npm \
47 libssl-dev git curl $CHROMEDRIVER
48 if ! type geckodriver >/dev/null 2>&1; then
49 curl -LO "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux$ARCH.tar.gz"
50 tar -zxvf "geckodriver-v0.24.0-linux$ARCH.tar.gz"
51 rm -f "geckodriver-v0.24.0-linux$ARCH.tar.gz"
52 $SUDO_SHIM mv geckodriver /usr/bin/geckodriver
53 $SUDO_SHIM chown root /usr/bin/geckodriver
54 $SUDO_SHIM chmod 755 /usr/bin/geckodriver
56 if [ ! -f /usr/lib/chromium-browser/chromedriver ] && [ -f `which chromedriver` ]; then
57 $SUDO_SHIM ln -s `which chromedriver` /usr/lib/chromium-browser/chromedriver
60 # macOS installation
61 elif type brew >/dev/null 2>&1; then
62 brew list python &>/dev/null || brew install python
63 brew cask install chromedriver
64 brew install libxml2 gnu-sed
65 brew install node
66 if ! echo $PATH | grep -ql /usr/local/bin ; then
67 echo '/usr/local/bin not found in $PATH, please add it.'
70 # distros that use rpm (Fedora, Suse, CentOS) installation
71 elif type dnf >/dev/null 2>&1; then
72 $SUDO_SHIM dnf install -y firefox gcc git libcurl-devel libxml2-devel \
73 libxslt-devel python3-devel redhat-rpm-config xorg-x11-server-Xvfb which \
74 findutils procps openssl openssl-devel chromium GConf2
75 if ! type chromedriver >/dev/null; then
76 curl -O "https://chromedriver.storage.googleapis.com/2.23/chromedriver_linux$ARCH.zip"
77 unzip "chromedriver_linux$ARCH.zip"
78 rm -f "chromedriver_linux$ARCH.zip"
79 $SUDO_SHIM mv chromedriver /usr/bin/chromedriver
80 $SUDO_SHIM chown root /usr/bin/chromedriver
81 $SUDO_SHIM chmod 755 /usr/bin/chromedriver
83 if ! type geckodriver >/dev/null 2>&1; then
84 curl -LO "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz"
85 tar -zxvf "geckodriver-v0.24.0-macos.tar.gz"
86 rm -f "geckodriver-v0.24.0-macos.tar.gz"
87 $SUDO_SHIM mv geckodriver /usr/bin/geckodriver
88 $SUDO_SHIM chown root /usr/bin/geckodriver
89 $SUDO_SHIM chmod 755 /usr/bin/geckodriver
92 # This is needed for Firefox on some systems. See here for more information:
93 # https://github.com/EFForg/https-everywhere/pull/5584#issuecomment-238655443
94 if [ ! -f /var/lib/dbus/machine-id ]; then
95 $SUDO_SHIM sh -c 'dbus-uuidgen > /var/lib/dbus/machine-id'
97 export PYCURL_SSL_LIBRARY=openssl
99 #Node
100 curl -sL https://rpm.nodesource.com/setup_12.x | $SUDO_SHIM bash -
101 $SUDO_SHIM yum install -y nodejs
102 $SUDO_SHIM yum install gcc-c++ make
103 else
104 echo \
105 "Your distro isn't supported by this script yet!"\
106 "Please install dependencies manually."
107 exit
110 # Get the addon SDK submodule and rule checker
111 git submodule init
112 git submodule update
114 # Install Python packages
115 pip3 install --user -r requirements.txt
116 cd test/rules
117 pip3 install --user -r requirements.txt
118 cd -
119 cd test/chromium
120 pip3 install --user -r requirements.txt
121 cd -
123 # Install Node Package for CRX Verification
124 $SUDO_SHIM npm -g i crx3-utils
126 # Install git hook to run tests before pushing.
127 ln -sf ../../test.sh .git/hooks/pre-push