summaryrefslogtreecommitdiff
path: root/install_dependencies.sh
blob: 603d10aad6316888cb72ca5a14d4b7b903d1819b (plain)
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
#!/usr/bin/env bash
# Copyright (C) 2016  Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# =*= License: GPL-2 =*=

#
# This is a bash script which attempts to install ybd's dependencies.
# It's mainly intended for ci and automated test setups...
#

# echo what we're doing
set -x

SUDO=""
if [ "$(id -u)" -ne 0 ];
  then SUDO="sudo"
fi

installed=false
# install dependencies for debian, ubuntu
command -v apt-get >/dev/null 2>&1
if [ $? -eq 0 ]; then
    $SUDO apt-get -qq update
    $SUDO apt-get -qq remove python-pip
    $SUDO apt-get -qq install build-essential gawk git m4 wget python python-dev git
    if [ $? -ne 0 ]; then
        echo "Install failed"
        exit 1
    fi
    installed=true
fi

# install for fedora
command -v dnf >/dev/null 2>&1
if [ $? -eq 0 ] && [ $installed = false ]; then
    $SUDO dnf remove -y python-pip
    $SUDO dnf install -y which make automake gcc gcc-c++ gawk git m4 wget python python-devel git redhat-rpm-config findutils
    if [ $? -ne 0 ]; then
        echo "Install failed"
        exit 1
    fi
    installed=true
fi

# install for aws
command -v yum >/dev/null 2>&1
if [ $? -eq 0 ] && [ $installed = false ]; then
    $SUDO yum remove -y python-pip
    $SUDO yum install -y which make automake gcc gcc-c++ gawk git m4 wget python python-devel git
    if [ $? -ne 0 ]; then
        echo "Install failed"
        exit 1
    fi
    installed=true
fi

# install for Arch
command -v pacman >/dev/null 2>&1
if [ $? -eq 0 ] && [ $installed = false ]; then
    $SUDO pacman -S --noconfirm which make automake gcc gawk git m4 wget python2 git
    if [ $? -ne 0 ]; then
        echo "Install failed"
        exit 1
    fi
    installed=true
fi

if [ $installed = false ]; then
    echo "No way to install dependencies: [apt|dnf|yum|pacman] not found"
    exit 1
fi

pip --version 2>&1 > /dev/null
if [ $? -ne 0 ]; then
    wget https://bootstrap.pypa.io/get-pip.py
    chmod +x get-pip.py
    $SUDO ./get-pip.py
    $SUDO rm get-pip.py
fi

$SUDO pip install -U pip

$SUDO pip install -U -r requirements.freeze.txt