From e4003290e02789ca0116c4c45a04d9f429f7ce22 Mon Sep 17 00:00:00 2001 From: lantz Date: Wed, 13 Jan 2021 23:24:06 -0800 Subject: [PATCH] Try to install python2 and python3 mininet (#1008) --- util/install.sh | 4 ++-- util/vm/build.py | 7 ++++++- util/vm/install-mininet-vm.sh | 12 +++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/util/install.sh b/util/install.sh index fd7856d..8ea754c 100755 --- a/util/install.sh +++ b/util/install.sh @@ -183,8 +183,8 @@ function mn_deps { ${PYPKG}-pexpect ${PYPKG}-tk # Install pip $install ${PYPKG}-pip || $install ${PYPKG}-pip-whl - if ! ${PYTHON} -m pip; then - curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + if ! ${PYTHON} -m pip -V; then + wget https://bootstrap.pypa.io/get-pip.py sudo ${PYTHON} get-pip.py rm get-pip.py fi diff --git a/util/vm/build.py b/util/vm/build.py index b3abc22..4fd02a7 100755 --- a/util/vm/build.py +++ b/util/vm/build.py @@ -638,7 +638,8 @@ def checkOutBranch( vm, branch, prompt=Prompt ): vm.sendline( 'util/install.sh -n' ) -def interact( vm, tests, pre='', post='', prompt=Prompt ): +def interact( vm, tests, pre='', post='', prompt=Prompt, + clean=True): "Interact with vm, which is a pexpect object" login( vm ) log( '* Waiting for login...' ) @@ -677,6 +678,10 @@ def interact( vm, tests, pre='', post='', prompt=Prompt ): vm.sendline( "sudo sed -i -e 's/^GRUB_TERMINAL=serial/#GRUB_TERMINAL=serial/' " "/etc/default/grub; sudo update-grub" ) vm.expect( prompt ) + if clean: + log( '* Cleaning vm' ) + vm.sendline( '~/mininet/util/install.sh -d' ) + vm.expect( prompt ) log( '* Shutting down' ) vm.sendline( 'sync; sudo shutdown -h now' ) log( '* Waiting for EOF/shutdown' ) diff --git a/util/vm/install-mininet-vm.sh b/util/vm/install-mininet-vm.sh index 38dc318..2ea176e 100755 --- a/util/vm/install-mininet-vm.sh +++ b/util/vm/install-mininet-vm.sh @@ -24,7 +24,7 @@ if [ -e /etc/rc.local.backup ]; then sudo mv /etc/rc.local.backup /etc/rc.local fi # Fetch Mininet -sudo apt-get -y install git-core openssh-server +sudo apt-get -y -qq install git-core openssh-server git clone git://github.com/mininet/mininet # Optionally check out branch if [ "$1" != "" ]; then @@ -33,8 +33,14 @@ if [ "$1" != "" ]; then git checkout $1 popd fi -# Install Mininet -time mininet/util/install.sh +# Install Mininet for Python2 and Python3 +APT="sudo apt-get -y -qq" +$APT install python3 +$APT install python-is-python3 || true +$APT install python2 || $APT install python +python --version +time PYTHON=python3 mininet/util/install.sh +time PYTHON=python2 mininet/util/install.sh -n # Finalize VM time mininet/util/install.sh -tcd # Ignoring this since NOX classic is deprecated