diff --git a/evt-tools.py b/evt-tools.py index 15d1d6d..2f5b002 100644 --- a/evt-tools.py +++ b/evt-tools.py @@ -3,6 +3,7 @@ import sys sys.path.append('../') from scripts.Link import Link import subprocess +import os class EvtTools: @@ -28,24 +29,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", @@ -57,58 +58,82 @@ class EvtTools: link.sync(None) def clean(self): - subprocess.run(["ev-tools.sh clean"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh clean"], shell=True) def build_tools(self): - subprocess.run(["ev-tools.sh deps"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh deps"], shell=True) def pull_src(self): - subprocess.run(["ev-tools.sh src"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh src"], shell=True) def tincan(self): - subprocess.run(["ev-tools.sh tincan"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh tincan"], shell=True) def debpak(self): - subprocess.run(["ev-tools.sh debpak"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh debpak"], shell=True) def testbed(self): - subprocess.run(["ev-tools.sh testbed"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh testbed"], shell=True) def venv(self): - subprocess.run(["ev-tools.sh venv"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh venv"], shell=True) def xmpp(self): - subprocess.run(["ev-tools.sh xmpp"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh xmpp"], shell=True) def build_docker(self): - subprocess.run(["ev-tools.sh dkrimg"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh dkrimg"], shell=True) def build_webrtc(self): - subprocess.run(["ev-tools.sh build_webrtc"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh build_webrtc"], shell=True) def build_webrtc_release_ubuntu(self): - subprocess.run(["ev-tools.sh build_webrtc_with_release_ubuntu"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh build_webrtc_with_release_ubuntu"], shell=True) def build_webrtc_debug_raspberry(self): - subprocess.run(["ev-tools.sh build_webrtc_with_debug_raspberry_pi"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh build_webrtc_with_debug_raspberry_pi"], shell=True) def build_webrtc_release_raspberry(self): - subprocess.run(["ev-tools.sh build_webrtc_with_release_raspberry_pi"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh build_webrtc_with_release_raspberry_pi"], shell=True) def build_tincan(self): - subprocess.run(["ev-tools.sh build_tincan"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh build_tincan"], shell=True) def build_tincan_release_ubuntu(self): - subprocess.run(["ev-tools.sh build_tincan_release_ubuntu"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh build_tincan_release_ubuntu"], shell=True) def build_tincan_debug_raspberry(self): - subprocess.run(["ev-tools.sh build_tincan_debug_raspberry"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh build_tincan_debug_raspberry"], shell=True) def build_tincan_release_raspberry(self): - subprocess.run(["ev-tools.sh build_tincan_release_raspberry"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh build_tincan_release_raspberry"], shell=True) + + def check_for_link(self): + if os.path.isfile("ev-tools.sh"): + return True + else: + print("Please run evt --sync and then retry the command.") def all(self): - subprocess.run(["ev-tools.sh all"], shell=True) + if self.check_for_link(): + subprocess.run(["ev-tools.sh all"], shell=True) def main(): tools = EvtTools() diff --git a/scripts/evtool-v20.7.2 b/scripts/evtool-v20.7.2 index b4987bc..9b9abc6 100755 --- a/scripts/evtool-v20.7.2 +++ b/scripts/evtool-v20.7.2 @@ -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 @@ -24,30 +24,26 @@ function pull_src 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/ && \ + 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 +124,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 \ @@ -240,9 +236,6 @@ case $1 in src) pull_src ;; - tincan) - build_tincan - ;; debpak) make_debpak ;; diff --git a/setup-evt.sh b/setup-evt.sh index 8affb0d..3917635 100755 --- a/setup-evt.sh +++ b/setup-evt.sh @@ -1,4 +1,13 @@ #!/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 venv && \ source venv/bin/activate && \