Modified and cleaned up code

1) Removed the symlink and the old setup file.
2) debpak now creates a out folder and creates the debian package in it.
3) Shortened the names of some options.
pull/4/head
Rajath Ganesh 2020-10-07 15:33:34 -04:00
parent 408431acb3
commit 73e423981a
5 changed files with 38 additions and 219 deletions

View File

@ -1 +0,0 @@
./scripts/evtool-v20.7.2

View File

@ -28,24 +28,24 @@ class EvtTools:
help="Install openfire server.")
parser.add_argument("--build_docker", action="store_true", default=False, dest="dkrimg",
help="Builds the docker image if you have already built the debian package.")
parser.add_argument("--build_webrtc", action="store_true", default=False, dest="webrtc",
parser.add_argument("--build_wrtc", action="store_true", default=False, dest="webrtc",
help="Clones and builds the webrtc libraries for ubuntu and returns a debug build.")
parser.add_argument("--build_webrtc_release", action="store_true", default=False, dest="webrtc_r",
parser.add_argument("--build_wrtc_rel", action="store_true", default=False, dest="webrtc_r",
help="Clones and builds the webrtc libraries for ubuntu and returns a release build.")
parser.add_argument("--build_webrtc_raspberry_debug", action="store_true", default=False, dest="webrtc_r_d",
parser.add_argument("--build_wrtc_rpi_dbg", action="store_true", default=False, dest="webrtc_r_d",
help="Clones and builds the webrtc libraries for raspberry and returns a debug build.")
parser.add_argument("--build_webrtc_raspberry_release", action="store_true", default=False, dest="webrtc_r_r",
parser.add_argument("--build_wrtc_rpi_rel", action="store_true", default=False, dest="webrtc_r_r",
help="Clones and builds the webrtc libraries for raspberry and returns a release build.")
parser.add_argument("--build_tincan", action="store_true", default=False, dest="tincan",
help="Builds the tincan debug executable for ubuntu. It assumes you have the webrtc "
"libraries already cloned or built")
parser.add_argument("--build_tincan_release", action="store_true", default=False, dest="tincan_r",
parser.add_argument("--build_tincan_rel", action="store_true", default=False, dest="tincan_r",
help="Builds the tincan release executable for ubuntu. It assumes you have the webrtc "
"libraries already cloned or built")
parser.add_argument("--build_tincan_raspberry_debug", action="store_true", default=False, dest="tincan_r_d",
parser.add_argument("--build_tincan_rpi_dbg", action="store_true", default=False, dest="tincan_r_d",
help="Builds the tincan debug executable for raspberry. It assumes you have the webrtc "
"libraries already cloned or built")
parser.add_argument("--build_tincan_raspberry_release", action="store_true", default=False, dest="tincan_r_r",
parser.add_argument("--build_tincan_rpi_rel", action="store_true", default=False, dest="tincan_r_r",
help="Builds the tincan release executable for raspberry. It assumes you have the webrtc "
"libraries already cloned or built")
parser.add_argument("--all", action="store_true", default=False, dest="all",

View File

@ -1,7 +1,7 @@
#!/bin/bash
EVIO=https://github.com/EdgeVPNio/evio.git
#EXLIBS=https://github.com/ipop-project/3rd-Party-Libs.git
EXLIBS=https://github.com/ipop-project/3rd-Party-Libs.git
PY=python3.8
function install_build_tools
@ -35,19 +35,23 @@ function make_tincan
function make_debpak
{
wd=$(pwd)
cp ../evio/controller/Controller.py debian-package/edge-vpnio/opt/edge-vpnio/ && \
mkdir -p debian-package/edge-vpnio/etc/opt/edge-vpnio/
cp ../evio/controller/template-config.json debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \
cp -r ../evio/controller/modules/ ../evio/controller/framework/ debian-package/edge-vpnio/opt/edge-vpnio/ && \
chmod 0775 debian-package/edge-vpnio/opt/edge-vpnio/framework/ && \
chmod 0664 debian-package/edge-vpnio/opt/edge-vpnio/framework/* && \
chmod 0775 debian-package/edge-vpnio/opt/edge-vpnio/modules/ && \
chmod 0664 debian-package/edge-vpnio/opt/edge-vpnio/modules/* && \
chmod 0664 debian-package/edge-vpnio/opt/edge-vpnio/Controller.py && \
chmod 0664 debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \
cp ../evio/tincan/trunk/out/release/x86_64/tincan debian-package/edge-vpnio/opt/edge-vpnio/ && \
chmod 0775 debian-package/edge-vpnio/opt/edge-vpnio/tincan && \
cd debian-package/ && \
cd ../../..
mkdir -p out
cd $wd
cp ../debian-package ../../../out
cp ../evio/controller/Controller.py ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
mkdir -p ../../../out/debian-package/edge-vpnio/etc/opt/edge-vpnio/
cp ../evio/controller/template-config.json ../../../out/debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \
cp -r ../evio/controller/modules/ ../evio/controller/framework/ ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
chmod 0775 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/framework/ && \
chmod 0664 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/framework/* && \
chmod 0775 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/modules/ && \
chmod 0664 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/modules/* && \
chmod 0664 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/Controller.py && \
chmod 0664 ../../../out/debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \
cp ../evio/tincan/trunk/out/release/x86_64/tincan ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/ && \
chmod 0775 ../../../out/debian-package/edge-vpnio/opt/edge-vpnio/tincan && \
cd ../../../out/debian-package/ && \
./deb-gen && \
rm -rf edge-vpnio/opt/edge-vpnio/framework \
edge-vpnio/opt/edge-vpnio/modules \
@ -128,8 +132,8 @@ function do_clean
make clean;
cd $wd
#debian pak
cd debian-package/ && \
rm -ri ./../edge-vpnio_20.7_amd64.deb \
cd ../debian-package/ && \
rm -ri ./edge-vpnio_20.7_amd64.deb \
edge-vpnio/opt/edge-vpnio/framework \
edge-vpnio/opt/edge-vpnio/modules \
edge-vpnio/opt/edge-vpnio/tincan \

193
setup
View File

@ -1,193 +0,0 @@
#!/bin/bash
EVIO=https://github.com/EdgeVPNio/evio.git
EXLIBS=https://github.com/ipop-project/3rd-Party-Libs.git
PY=python3.8
function install_build_tools
{
sudo bash -c "
apt-get update -y && \
apt-get install -y git \
make clang libc++-dev libssl-dev $PY"
}
function pull_src
{
wd=$(pwd)
cd ..
#stat evio dir clone or pull
git clone $EVIO
cd evio/tincan/external
#
git clone -b ubuntu-x64 --single-branch https://github.com/ipop-project/3rd-Party-Libs.git
cd $wd
}
function make_tincan
{
wd=$(pwd)
cd ../evio/tincan/trunk/build
make clean; make
cd $wd
}
function make_debpak
{
wd=$(pwd)
cp ../evio/controller/Controller.py debian-package/edge-vpnio/opt/edge-vpnio/ && \
mkdir -p debian-package/edge-vpnio/etc/opt/edge-vpnio/
cp ../evio/controller/template-config.json debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \
cp -r ../evio/controller/modules/ ../evio/controller/framework/ debian-package/edge-vpnio/opt/edge-vpnio/ && \
chmod 0775 debian-package/edge-vpnio/opt/edge-vpnio/framework/ && \
chmod 0664 debian-package/edge-vpnio/opt/edge-vpnio/framework/* && \
chmod 0775 debian-package/edge-vpnio/opt/edge-vpnio/modules/ && \
chmod 0664 debian-package/edge-vpnio/opt/edge-vpnio/modules/* && \
chmod 0664 debian-package/edge-vpnio/opt/edge-vpnio/Controller.py && \
chmod 0664 debian-package/edge-vpnio/etc/opt/edge-vpnio/config.json && \
cp ../evio/tincan/trunk/out/release/x86_64/tincan debian-package/edge-vpnio/opt/edge-vpnio/ && \
chmod 0775 debian-package/edge-vpnio/opt/edge-vpnio/tincan && \
cd debian-package/ && \
./deb-gen && \
rm -rf edge-vpnio/opt/edge-vpnio/framework \
edge-vpnio/opt/edge-vpnio/modules \
edge-vpnio/opt/edge-vpnio/tincan \
edge-vpnio/opt/edge-vpnio/template-config.json \
edge-vpnio/opt/edge-vpnio/Controller.py \
edge-vpnio/etc/opt/edge-vpnio/config.json
cd $wd
}
function install_testbed_deps
{
sudo bash -c "
apt-get update -y && \
apt-get install -y openvswitch-switch \
$PY python3-pip python3-venv python3-dev \
apt-transport-https \
ca-certificates \
curl git \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable\" && \
apt-cache policy docker-ce && \
apt-get install -y containerd.io \
docker-ce-cli \
docker-ce && \
groupadd -f docker && \
usermod -a -G docker $USER \
"
echo "You must logout and relogin for docker group membership to take effect."
}
function make_venv
{
wd=$(pwd)
cd testbed && \
$PY -m venv venv && \
source venv/bin/activate && \
pip3 install simplejson
cd $wd
}
function make_dkrimg
{
mv debian-package/edge-vpnio_20.7_amd64.deb docker-image/ && \
docker build -f ./docker-image/evio-base.Dockerfile -t edgevpnio/evio-base:1.0 ./docker-image && \
docker build -f ./docker-image/evio-node.Dockerfile -t edgevpnio/evio-node:20.7.3 ./docker-image
}
function install_openfire
{
docker run --name openfire -d \
-p 9090:9090 -p 5222:5222 \
-p 5269:5269 -p 5223:5223 \
-p 7443:7443 -p 7777:7777 \
-p 7070:7070 -p 5229:5229 \
-p 5275:5275 \
edgevpnio/openfire_edgevpn_demo
}
function install_portal
{
#Todo: visualizer not yet available
git clone https://github.com/edgevpnio/portal.git
cd portal/setup
./setup.sh
chown -R $USER /users/$USER/
}
function do_clean
{
# tincan
wd=$(pwd)
cd ../evio/tincan/trunk/build
make clean;
cd $wd
#debian pak
cd debian-package/ && \
rm -ri ./edge-vpnio_20.7_amd64.deb \
edge-vpnio/opt/edge-vpnio/framework \
edge-vpnio/opt/edge-vpnio/modules \
edge-vpnio/opt/edge-vpnio/tincan \
edge-vpnio/opt/edge-vpnio/template-config.json \
edge-vpnio/opt/edge-vpnio/Controller.py && \
cd $wd
# docker-image
rm -f docker-image/edge-vpnio_20.7_amd64.deb
docker rmi edgevpnio/evio-base:1.0 edgevpnio/evio-node:20.7
docker rmi $(docker images -q --filter "dangling=true")
# testbed
cd testbed
rm -rf config log cert venv
cd $wd
}
function do_full_setup
{
install_build_tools
pull_src
make_tincan
make_debpak
make_dkrimg
make_testbed_prereqs
make_venv
}
case $1 in
deps)
install_build_tools
;;
src)
pull_src
;;
tincan)
make_tincan
;;
debpak)
make_debpak
;;
dkrimg)
make_dkrimg
;;
testbed)
install_testbed_deps
;;
venv)
make_venv
;;
xmpp)
install_openfire
;;
clean)
do_clean
;;
all)
do_full_setup
;;
*)
echo "no match on input -> $1"
;;
esac

View File

@ -1,7 +1,16 @@
#!/bin/bash
sudo apt install -y python3.8 python3.8-dev python3.8-venv python3-pip
ls /usr/bin/python*
update-alternatives --display python
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 20
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 30
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 40
update-alternatives --display python
python -V
deactivate 2>/dev/null
python -m venv myenv && \
source myenv/bin/activate && \
python -m venv venv && \
source venv/bin/activate && \
export PATH="$PATH:." && \
chmod 775 ./evt && \
pip3 install gitpython simplejson