-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmarple_dev_setup
More file actions
executable file
·97 lines (80 loc) · 2.84 KB
/
marple_dev_setup
File metadata and controls
executable file
·97 lines (80 loc) · 2.84 KB
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
#!/bin/bash
# -------------------------------------------------------------
# marple_dev_setup - Sets up marple for development
# July-Sep 2018 - Hrutvik Kanabar, Franz Nowak
# -------------------------------------------------------------
if command -v python3 &> /dev/null; then
echo Python 3 is installed.
else
echo Fatal error: Python 3 is not installed.
exit 1
fi
if command -v git &> /dev/null; then
echo Git is installed.
else
echo Fatal error: git is not installed.
exit 1
fi
# Setup colours
BEGIN="\033[36m\033[1m\033[4m"
END="\033[0m\033[0m\033[0m\n"
# Set up marple directory
MARPLE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
printf "${BEGIN}Updating...${END}"
sudo apt-get update
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Installing linux-tools... ${END}"
sudo apt-get -y install linux-tools-generic linux-tools-common linux-tools-`uname -r` smem
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Installing venv... ${END}"
sudo apt-get -y install python3-venv
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Creating virtual environment... ${END}"
python3 -m venv marple_env
source marple_env/bin/activate
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Installing Python requirements... ${END}"
python3 -m pip install -U pip
sudo apt-get -y install python3-tk
python3 -m pip install -r ./requirements.txt
printf "${BEGIN}Done.${END}\n\n\n"
# Deactivate virtual environment
deactivate
printf "${BEGIN}Changing sudoers file... ${END}"
echo 'Defaults env_keep += "PYTHONPATH"' | sudo EDITOR='tee -a' visudo > /dev/null
echo 'Defaults env_keep += "XDG_RUNTIME_DIR"' | sudo EDITOR='tee -a' visudo > /dev/null
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Installing BCC... ${END}"
codename=`lsb_release -cs`
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D4284CDD
echo "deb https://repo.iovisor.org/apt/${codename} ${codename} main" | sudo tee /etc/apt/sources.list.d/iovisor.list
sudo apt-get update
sudo apt-get -y --allow-unauthenticated install bcc-tools libbcc-examples linux-headers-$(uname -r)
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Installing dependencies for vpp/g2... ${END}"
sudo apt-get -y install libtool m4 automake libgtk2.0-dev
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Adding vpp/g2 submodule... ${END}"
# initialise the submodule
git submodule init
git submodule update
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Configuring vpp/g2... ${END}"
# do some config
cd vpp/src
libtoolize
aclocal
autoconf
automake --add-missing
autoreconf
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Installing vpp/g2... ${END}"
# install g2
cd ../build-root
make g2-install
printf "${BEGIN}Done.${END}\n\n\n"
printf "${BEGIN}Creating symlink... ${END}"
cd /usr/bin
sudo ln -s ${MARPLE_DIR}/marple_dev_run marple
source ~/.bashrc
printf "${BEGIN}Done.${END}\n\n\n"