-
Notifications
You must be signed in to change notification settings - Fork 25
/
install.sh
executable file
·99 lines (79 loc) · 2.39 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
91
92
93
94
95
96
97
98
99
#!/bin/bash
cwd=$(pwd)
version=$(lsb_release -rs )
doc=false
test=false
# Setting up test and doc parameters
while getopts ":dt" opt; do
case $opt in
d)
printf "Installing with documentation dependencies.\n"
doc=true
;;
t)
printf "Installing with testing dependencies.\n"
test=true
;;
\?)
printf "Unknown option. Proceeding without installing documentation and testing dependencies.\n"
;;
esac
done
sleep 3
# Update apt
sudo apt update
# Installing necessary packages
sudo apt install -y git python3 python3-pip curl
sudo python3 -m pip install cpppo
# MiniCPS
cd ~
git clone --depth 1 https://github.com/scy-phy/minicps.git || git -C minicps pull
cd minicps
sudo python3 -m pip install .
# epynet - An EPANET Python wrapper for WNTR
cd ~
git clone --depth 1 https://github.com/afmurillo/DHALSIM-epynet || git -C DHALSIM-epynet pull
cd DHALSIM-epynet/
sudo python3 -m pip install .
# Mininet from source
cd ~
git clone --depth 1 -b 2.3.1b4 https://github.com/mininet/mininet.git || git -C mininet pull
cd mininet
sudo PYTHON=python3 ./util/install.sh -fnv
# Installing testing pip dependencies
if [ "$test" = true ]
then
sudo python3 -m pip install pytest-timeout
sudo python3 -m pip install pytest-cov
sudo python3 -m pip install pytest-mock
fi
# Install netfilterqueue for Simple DoS attacks
sudo apt install -y libnfnetlink-dev libnetfilter-queue-dev
sudo python3 -m pip install -U git+https://github.com/kti/python-netfilterqueue
# Install DHALSIM
cd "${cwd}" || { printf "Failure: Could not find DHALSIM directory\n"; exit 1; }
# Install without doc and test
if [ "$test" = false ] && [ "$doc" = false ]
then
sudo python3 -m pip install -e .
printf "\nInstallation finished. You can now run DHALSIM by using \n\t<sudo dhalsim your_config.yaml>.\n"
exit 0;
fi
# Install doc
if [ "$test" = false ]
then
sudo python3 -m pip install -e .[doc]
printf "\nInstallation finished. You can now run DHALSIM by using \n\t<sudo dhalsim your_config.yaml>.\n"
exit 0;
fi
# Install test
if [ "$doc" = false ]
then
sudo python3 -m pip install -e .[test]
printf "\nInstallation finished. You can now run DHALSIM by using \n\t<sudo dhalsim your_config.yaml>.\n"
exit 0;
fi
# Install test and doc
sudo python3 -m pip install -e .[test,doc]
printf "\nInstallation finished. You can now run DHALSIM by using \n\t<sudo dhalsim your_config.yaml>.\n"
exit 0;