-
Notifications
You must be signed in to change notification settings - Fork 4
/
cb_dep.sh
executable file
·123 lines (110 loc) · 3.76 KB
/
cb_dep.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/sh
#################################################################################
# Title: Cloudbox: Dependencies Installer #
# Author(s): L3uddz, Desimaniac, EnorMOZ #
# URL: https://github.com/Cloudbox/Cloudbox #
# Description: Installs dependencies needed for Cloudbox. #
# -- #
# Part of the Cloudbox project: https://cloudbox.works #
#################################################################################
# GNU General Public License v3.0 #
#################################################################################
## Variables
VERBOSE=false
## Constants
readonly SYSCTL_PATH="/etc/sysctl.conf"
readonly APT_SOURCES_URL="https://raw.githubusercontent.com/cloudbox/cb/master/apt-sources"
readonly PYTHON_CMD_SUFFIX="-m pip install \
--no-cache-dir \
--disable-pip-version-check \
--upgrade \
--force-reinstall"
readonly PYTHON3_CMD="python3 $PYTHON_CMD_SUFFIX"
readonly PYTHON2_CMD="python $PYTHON_CMD_SUFFIX"
readonly PIP="9.0.3"
readonly ANSIBLE=">=2.8,<2.9"
while getopts 'v' f; do
case $f in
v) VERBOSE=true;;
esac
done
$VERBOSE || exec >/dev/null
## Disable IPv6
if [ -f "$SYSCTL_PATH" ]; then
if [[ $(lsb_release -rs) < 18.04 ]]; then
## Add 'Disable IPv6' entries into systctl
grep -q -F 'net.ipv6.conf.all.disable_ipv6 = 1' "$SYSCTL_PATH" || \
echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> "$SYSCTL_PATH"
grep -q -F 'net.ipv6.conf.default.disable_ipv6 = 1' "$SYSCTL_PATH" || \
echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> "$SYSCTL_PATH"
grep -q -F 'net.ipv6.conf.lo.disable_ipv6 = 1' "$SYSCTL_PATH" || \
echo 'net.ipv6.conf.lo.disable_ipv6 = 1' >> "$SYSCTL_PATH"
sysctl -p
else
## Remove 'Disable IPv6' entries from systctl
sed -i -e '/^net.ipv6.conf.all.disable_ipv6/d' "$SYSCTL_PATH"
sed -i -e '/^net.ipv6.conf.default.disable_ipv6/d' "$SYSCTL_PATH"
sed -i -e '/^net.ipv6.conf.lo.disable_ipv6/d' "$SYSCTL_PATH"
sysctl -p
fi
fi
## AppVeyor
if [ "$SUDO_USER" = "appveyor" ]; then
rm /etc/apt/sources.list.d/*
rm /etc/apt/sources.list
if [[$(lsb_release -cs) == "bionic" ]]; then
APT_SOURCES_URL="$APT_SOURCES_URL/bionic.txt"
else
APT_SOURCES_URL="$APT_SOURCES_URL/xenial.txt"
fi
curl $APT_SOURCES_URL | tee /etc/apt/sources.list
apt-get update
fi
## Environmental Variables
export DEBIAN_FRONTEND=noninteractive
## Install Pre-Dependencies
apt-get install -y --reinstall \
software-properties-common \
apt-transport-https
apt-get update
## Add apt repos
add-apt-repository main
add-apt-repository universe
add-apt-repository restricted
add-apt-repository multiverse
apt-get update
## Install apt Dependencies
apt-get install -y --reinstall \
nano \
git \
build-essential \
libssl-dev \
libffi-dev \
python3-dev \
python3-pip \
python-dev \
python-pip \
python-apt
## Install pip3 Dependencies
$PYTHON3_CMD \
pip==${PIP}
$PYTHON3_CMD \
setuptools
$PYTHON3_CMD \
pyOpenSSL \
requests \
netaddr
## Install pip2 Dependencies
$PYTHON2_CMD \
pip==${PIP}
$PYTHON2_CMD \
setuptools
$PYTHON2_CMD \
pyOpenSSL \
requests \
netaddr \
jmespath \
ansible$ANSIBLE
## Copy /usr/local/bin/pip to /usr/bin/pip
[ -f /usr/local/bin/pip ] && cp /usr/local/bin/pip /usr/bin/pip
[ -f /usr/local/bin/pip3 ] && cp /usr/local/bin/pip3 /usr/bin/pip3